Skip to content

Commit 0ba237e

Browse files
authored
Merge pull request #58 from tchssk/goa3.25.3
Bump goa.design/goa/v3 from 3.25.2 to 3.25.3
2 parents 8e2b4d5 + ac9c5e7 commit 0ba237e

File tree

5 files changed

+33
-28
lines changed

5 files changed

+33
-28
lines changed

autotrailingslash/testdata/code.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,14 @@ func EncodeMethod2Response(encoder func(context.Context, http.ResponseWriter) go
250250
// Method2 endpoint.
251251
func DecodeMethod2Request(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*service.Method2Payload, error) {
252252
return func(r *http.Request) (*service.Method2Payload, error) {
253+
var payload *service.Method2Payload
253254
var (
254255
param1 string
255256
256257
params = mux.Vars(r)
257258
)
258259
param1 = params["param1"]
259-
payload := NewMethod2Payload(param1)
260+
payload = NewMethod2Payload(param1)
260261
261262
return payload, nil
262263
}
@@ -275,13 +276,14 @@ func EncodeMethod3Response(encoder func(context.Context, http.ResponseWriter) go
275276
// Method3 endpoint.
276277
func DecodeMethod3Request(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*service.Method3Payload, error) {
277278
return func(r *http.Request) (*service.Method3Payload, error) {
279+
var payload *service.Method3Payload
278280
var (
279281
param2 string
280282
281283
params = mux.Vars(r)
282284
)
283285
param2 = params["param2"]
284-
payload := NewMethod3Payload(param2)
286+
payload = NewMethod3Payload(param2)
285287
286288
return payload, nil
287289
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.24.0
44

55
require (
66
github.com/stretchr/testify v1.11.1
7-
goa.design/goa/v3 v3.25.2
7+
goa.design/goa/v3 v3.25.3
88
)
99

1010
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
4343
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
4444
github.com/woodsbury/decimal128 v1.3.0 h1:8pffMNWIlC0O5vbyHWFZAt5yWvWcrHA+3ovIIjVWss0=
4545
github.com/woodsbury/decimal128 v1.3.0/go.mod h1:C5UTmyTjW3JftjUFzOVhC20BEQa2a4ZKOB5I6Zjb+ds=
46-
goa.design/goa/v3 v3.25.2 h1:8Sa8PtDsWAWU/Z2BDCAH+NM6VSEuwEuqj4AJwapVgOw=
47-
goa.design/goa/v3 v3.25.2/go.mod h1:VZ8CcXJRZh09ijtNJJS2gNyKufpmrM+Ul/Qy3viwcOU=
46+
goa.design/goa/v3 v3.25.3 h1:gnOm2Vu0HMvveKpcqL6aWYQTP2puiwrEJWLQc79/294=
47+
goa.design/goa/v3 v3.25.3/go.mod h1:VZ8CcXJRZh09ijtNJJS2gNyKufpmrM+Ul/Qy3viwcOU=
4848
golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c=
4949
golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU=
5050
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=

optionalbody/generate.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func update(f *codegen.File) {
104104
section.Source = strings.Replace(section.Source,
105105
` {{- if .Payload.Request.MustHaveBody }}
106106
if errors.Is(err, io.EOF) {
107-
return nil, goa.MissingPayloadError()
107+
return payload, goa.MissingPayloadError()
108108
}
109109
{{- else }}
110110
if errors.Is(err, io.EOF) {
@@ -113,18 +113,18 @@ func update(f *codegen.File) {
113113
{{- end }}
114114
var gerr *goa.ServiceError
115115
if errors.As(err, &gerr) {
116-
return nil, gerr
116+
return payload, gerr
117117
}
118-
return nil, goa.DecodePayloadError(err.Error())
118+
return payload, goa.DecodePayloadError(err.Error())
119119
{{- if not .Payload.Request.MustHaveBody }}
120120
}
121121
{{- end }}`,
122122
` if !errors.Is(err, io.EOF) {
123123
var gerr *goa.ServiceError
124124
if errors.As(err, &gerr) {
125-
return nil, gerr
125+
return payload, gerr
126126
}
127-
return nil, goa.DecodePayloadError(err.Error())
127+
return payload, goa.DecodePayloadError(err.Error())
128128
}
129129
emptyBody = true
130130
err = nil`,
@@ -134,22 +134,22 @@ func update(f *codegen.File) {
134134
` {{- if .Payload.Request.ServerBody.ValidateRef }}
135135
{{ .Payload.Request.ServerBody.ValidateRef }}
136136
if err != nil {
137-
return nil, err
137+
return payload, err
138138
}
139139
{{- end }}`,
140140
` {{- if .Payload.Request.ServerBody.ValidateRef }}
141141
if !emptyBody {
142142
{{ .Payload.Request.ServerBody.ValidateRef }}
143143
if err != nil {
144-
return nil, err
144+
return payload, err
145145
}
146146
}
147147
{{- end }}`,
148148
-1,
149149
)
150150
section.Source = strings.Replace(section.Source,
151-
` payload := {{ .Payload.Request.PayloadInit.Name }}({{ range .Payload.Request.PayloadInit.ServerArgs }}{{ .Ref }}, {{ end }})`,
152-
` payload := {{ .Payload.Request.PayloadInit.Name }}`+serverPayloadInitNameSuffix+`({{ range .Payload.Request.PayloadInit.ServerArgs }}{{ .Ref }}, {{ end }})
151+
` payload = {{ .Payload.Request.PayloadInit.Name }}({{ range .Payload.Request.PayloadInit.ServerArgs }}{{ .Ref }}, {{ end }})`,
152+
` payload = {{ .Payload.Request.PayloadInit.Name }}`+serverPayloadInitNameSuffix+`({{ range .Payload.Request.PayloadInit.ServerArgs }}{{ .Ref }}, {{ end }})
153153
if !emptyBody {
154154
payload = {{ .Payload.Request.PayloadInit.Name }}({{ range .Payload.Request.PayloadInit.ServerArgs }}{{ .Ref }}, {{ end }})
155155
}`,

optionalbody/testdata/code.go

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func EncodeMethod1Response(encoder func(context.Context, http.ResponseWriter) go
8787
// Method1 endpoint.
8888
func DecodeMethod1Request(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*service1.Payload, error) {
8989
return func(r *http.Request) (*service1.Payload, error) {
90+
var payload *service1.Payload
9091
var (
9192
body Method1RequestBody
9293
emptyBody bool
@@ -97,20 +98,20 @@ func DecodeMethod1Request(mux goahttp.Muxer, decoder func(*http.Request) goahttp
9798
if !errors.Is(err, io.EOF) {
9899
var gerr *goa.ServiceError
99100
if errors.As(err, &gerr) {
100-
return nil, gerr
101+
return payload, gerr
101102
}
102-
return nil, goa.DecodePayloadError(err.Error())
103+
return payload, goa.DecodePayloadError(err.Error())
103104
}
104105
emptyBody = true
105106
err = nil
106107
}
107108
if !emptyBody {
108109
err = ValidateMethod1RequestBody(&body)
109110
if err != nil {
110-
return nil, err
111+
return payload, err
111112
}
112113
}
113-
payload := NewMethod1PayloadWithOptionalBody(&body)
114+
payload = NewMethod1PayloadWithOptionalBody(&body)
114115
if !emptyBody {
115116
payload = NewMethod1Payload(&body)
116117
}
@@ -132,26 +133,27 @@ func EncodeMethod2Response(encoder func(context.Context, http.ResponseWriter) go
132133
// Method2 endpoint.
133134
func DecodeMethod2Request(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*service1.Payload, error) {
134135
return func(r *http.Request) (*service1.Payload, error) {
136+
var payload *service1.Payload
135137
var (
136138
body Method2RequestBody
137139
err error
138140
)
139141
err = decoder(r).Decode(&body)
140142
if err != nil {
141143
if errors.Is(err, io.EOF) {
142-
return nil, goa.MissingPayloadError()
144+
return payload, goa.MissingPayloadError()
143145
}
144146
var gerr *goa.ServiceError
145147
if errors.As(err, &gerr) {
146-
return nil, gerr
148+
return payload, gerr
147149
}
148-
return nil, goa.DecodePayloadError(err.Error())
150+
return payload, goa.DecodePayloadError(err.Error())
149151
}
150152
err = ValidateMethod2RequestBody(&body)
151153
if err != nil {
152-
return nil, err
154+
return payload, err
153155
}
154-
payload := NewMethod2Payload(&body)
156+
payload = NewMethod2Payload(&body)
155157
156158
return payload, nil
157159
}
@@ -172,26 +174,27 @@ func EncodeMethod1Response(encoder func(context.Context, http.ResponseWriter) go
172174
// Method1 endpoint.
173175
func DecodeMethod1Request(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (*service2.Payload, error) {
174176
return func(r *http.Request) (*service2.Payload, error) {
177+
var payload *service2.Payload
175178
var (
176179
body Method1RequestBody
177180
err error
178181
)
179182
err = decoder(r).Decode(&body)
180183
if err != nil {
181184
if errors.Is(err, io.EOF) {
182-
return nil, goa.MissingPayloadError()
185+
return payload, goa.MissingPayloadError()
183186
}
184187
var gerr *goa.ServiceError
185188
if errors.As(err, &gerr) {
186-
return nil, gerr
189+
return payload, gerr
187190
}
188-
return nil, goa.DecodePayloadError(err.Error())
191+
return payload, goa.DecodePayloadError(err.Error())
189192
}
190193
err = ValidateMethod1RequestBody(&body)
191194
if err != nil {
192-
return nil, err
195+
return payload, err
193196
}
194-
payload := NewMethod1Payload(&body)
197+
payload = NewMethod1Payload(&body)
195198
196199
return payload, nil
197200
}

0 commit comments

Comments
 (0)