Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegen/example/templates/client_endpoint_init.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
}
if err != nil {
if err == flag.ErrHelp {
if errors.Is(err, flag.ErrHelp) {
os.Exit(0)
}
fmt.Fprintln(os.Stderr, err.Error())
Expand Down
2 changes: 1 addition & 1 deletion codegen/example/testdata/client-no-server.golden
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func main() {
}
}
if err != nil {
if err == flag.ErrHelp {
if errors.Is(err, flag.ErrHelp) {
os.Exit(0)
}
fmt.Fprintln(os.Stderr, err.Error())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func main() {
}
}
if err != nil {
if err == flag.ErrHelp {
if errors.Is(err, flag.ErrHelp) {
os.Exit(0)
}
fmt.Fprintln(os.Stderr, err.Error())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func main() {
}
}
if err != nil {
if err == flag.ErrHelp {
if errors.Is(err, flag.ErrHelp) {
os.Exit(0)
}
fmt.Fprintln(os.Stderr, err.Error())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func main() {
}
}
if err != nil {
if err == flag.ErrHelp {
if errors.Is(err, flag.ErrHelp) {
os.Exit(0)
}
fmt.Fprintln(os.Stderr, err.Error())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func main() {
}
}
if err != nil {
if err == flag.ErrHelp {
if errors.Is(err, flag.ErrHelp) {
os.Exit(0)
}
fmt.Fprintln(os.Stderr, err.Error())
Expand Down
6 changes: 3 additions & 3 deletions http/codegen/templates/client_sse.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ func (s *{{ .Method.VarName }}StreamImpl) RecvWithContext(ctx context.Context) (
var byts []byte
byts, err = s.readEvent(ctx)
if err != nil {
if err == io.EOF || err == context.Canceled || err == context.DeadlineExceeded {
if errors.Is(err, io.EOF) || errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
// Clean up on EOF or context cancellation
s.Close()
if err == io.EOF {
if errors.Is(err, io.EOF) {
err = nil
}
}
Expand Down Expand Up @@ -117,7 +117,7 @@ func (s *{{ .Method.VarName }}StreamImpl) readEvent(ctx context.Context) ([]byte
}

// Return partial data at EOF
if err == io.EOF {
if errors.Is(err, io.EOF) {
if len(eventData) > 0 {
return eventData, nil
}
Expand Down
2 changes: 1 addition & 1 deletion http/codegen/templates/partial/request_elements.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ qp := r.URL.Query()
{{- range .Cookies }}
c, {{ if not .Required }}_{{ else }}err{{ end }} = r.Cookie("{{ .HTTPName }}")
{{- if and (or (eq .Type.Name "string") (eq .Type.Name "any")) .Required }}
if err == http.ErrNoCookie {
if errors.Is(err, http.ErrNoCookie) {
err = goa.MergeErrors(err, goa.MissingFieldError("{{ .Name }}", "cookie"))
} else {
{{ .VarName }} = c.Value
Expand Down
4 changes: 2 additions & 2 deletions http/codegen/templates/request_decoder.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ func {{ .RequestDecoder }}(mux goahttp.Muxer, decoder func(*http.Request) goahtt
err = decoder(r).Decode(&body)
if err != nil {
{{- if .Payload.Request.MustHaveBody }}
if err == io.EOF {
if errors.Is(err, io.EOF) {
return nil, goa.MissingPayloadError()
}
{{- else }}
if err == io.EOF {
if errors.Is(err, io.EOF) {
err = nil
} else {
{{- end }}
Expand Down
Loading