Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gencli: warnings from staticcheck #1138

Open
timburks opened this issue Sep 17, 2022 · 2 comments
Open

gencli: warnings from staticcheck #1138

timburks opened this issue Sep 17, 2022 · 2 comments
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@timburks
Copy link
Contributor

timburks commented Sep 17, 2022

We recently ran the staticcheck linter on our project and found that some warnings were produced for generated CLI code.

apigee/registry#744
apigee/registry#746
apigee/registry#748
apigee/registry#749
apigee/registry#750

These look like reasonable (but admittedly low-priority) improvements to make, and each seems potentially tricky enough to warrant a separate PR. Would PRs addressing them be welcome? These might be good first issues for newcomers interested in the project.

@timburks timburks added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. priority: p3 Desirable enhancement or fix. May not be included in next release. labels Sep 17, 2022
@noahdietz
Copy link
Collaborator

Hey, yeah PRs would be welcome. I think all are worth addressing.

apigee/registry#744 I'm a little unsure about since the error strings get dumped to the command line, and are not part of a "Go library". Would you rather see a capitalized error message on console, or no?

@timburks
Copy link
Contributor Author

Here's what we're seeing for an error in the generated code:

$ registry rpc create-api --parent projects/one/locations/global --api.labels foo --api_id=test
Error: Invalid map item: "foo"
Usage:
  registry rpc create-api [flags]

[[ flag info deleted ]]

Invalid map item: "foo"

and this is what we show for an error from our API:

$ registry rpc create-api --parent projects/one/locations/global
Error: required flag(s) "api_id" not set
Usage:
  registry rpc create-api [flags]

[[ flag info deleted ]]

required flag(s) "api_id" not set

The error is printed twice - the second time, we're explicitly printing it (maybe we shouldn't /cc @seaneganx, @theganyo). But the first printing, which I think is from Cobra, seems to be consistent with what the linter is suggesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants