Skip to content

codegen/example: restore errors.Is for flag.ErrHelp regressed by #3734#3927

Merged
raphael merged 1 commit into
goadesign:v3from
stakahashy:fix/restore-errors-is-flag-errhelp
May 18, 2026
Merged

codegen/example: restore errors.Is for flag.ErrHelp regressed by #3734#3927
raphael merged 1 commit into
goadesign:v3from
stakahashy:fix/restore-errors-is-flag-errhelp

Conversation

@stakahashy
Copy link
Copy Markdown
Contributor

@stakahashy stakahashy commented May 18, 2026

Summary

  • restore errors.Is(err, flag.ErrHelp) in codegen/example/templates/client_endpoint_init.go.tpl (originally added by Use errors.Is() in templates #3736)
  • update the affected client golden files under codegen/example/testdata/

#3736 introduced errors.Is(err, flag.ErrHelp) so the generated example CLI passes golangci-lint with errorlint enabled. #3734 (Add JSON-RPC 2.0 Transport Support) was based on a state predating #3736 and inadvertently reintroduced err == flag.ErrHelp while adding the JSON-RPC scheme dispatch — see merge commit 8931cbb.

"errors" is already in the import spec list in codegen/example/example_client.go, so no additional source change is needed.

Test plan

  • go test ./codegen/example/...
  • go test ./codegen/... ./http/codegen/... (no regressions in adjacent codegen packages)
  • make lint

Related to #3736.

goadesign#3736 changed `err == flag.ErrHelp` to `errors.Is(err, flag.ErrHelp)` in
`codegen/example/templates/client_endpoint_init.go.tpl` so the generated
example client passes `golangci-lint` with `errorlint` enabled.

That fix was later overwritten by goadesign#3734 (Add JSON-RPC 2.0 Transport
Support, commit 8931cbb), which appears to have rebased on a pre-goadesign#3736
state and silently reverted the line back to `err == flag.ErrHelp`.

This commit restores the `errors.Is` form and updates the affected
golden testdata files. No other source change is required — the
`errors` package is already in the import spec list for the generated
file (`codegen/example/example_client.go:41`).
@stakahashy stakahashy changed the title fix: restore errors.Is for flag.ErrHelp regressed by JSON-RPC merge codegen/example: restore errors.Is for flag.ErrHelp regressed by #3734 May 18, 2026
@raphael
Copy link
Copy Markdown
Member

raphael commented May 18, 2026

Good catch, thank you!

@raphael raphael merged commit 818aeb9 into goadesign:v3 May 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants