struct
を含む次のものがありますnet/http.Request
。
type MyRequest struct {
http.Request
PathParams map[string]string
}
http.Request
ここで、次の関数で匿名の内部構造体を初期化します。
func New(origRequest *http.Request, pathParams map[string]string) *MyRequest {
req := new(MyRequest)
req.PathParams = pathParams
return req
}
パラメータで内部構造体を初期化するにはどうすればよいorigRequest
ですか?