codegen/example: restore errors.Is for flag.ErrHelp regressed by #3734#3927
Merged
raphael merged 1 commit intoMay 18, 2026
Merged
Conversation
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`).
Member
|
Good catch, thank you! |
This was referenced May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
errors.Is(err, flag.ErrHelp)incodegen/example/templates/client_endpoint_init.go.tpl(originally added by Use errors.Is() in templates #3736)codegen/example/testdata/#3736 introduced
errors.Is(err, flag.ErrHelp)so the generated example CLI passesgolangci-lintwitherrorlintenabled. #3734 (Add JSON-RPC 2.0 Transport Support) was based on a state predating #3736 and inadvertently reintroducederr == flag.ErrHelpwhile adding the JSON-RPC scheme dispatch — see merge commit8931cbb."errors"is already in the import spec list incodegen/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 lintRelated to #3736.