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

Allow nogo to accept analyzer-specific flags #3081

Closed
FastNav opened this issue Mar 6, 2022 · 0 comments
Closed

Allow nogo to accept analyzer-specific flags #3081

FastNav opened this issue Mar 6, 2022 · 0 comments

Comments

@FastNav
Copy link

FastNav commented Mar 6, 2022

Problem

It seems like nogo has no direct means of passing flags to 3rd party analyzers that consume flags. It seems reasonable to be able to pass this information through nogo for each analyzer.

Solutions

Config Map

"exhaustive": {
    "analyzer_flags": {
        "ignore-enum-members": "_UNSPECIFIED$"
    },
}

Config Array

"exhaustive": {
    "analyzer_args": ["-ignore-enum-members": "_UNSPECIFIED$"]
}

nogo Rule Mapping

As suggested in #1867, except since go_tool_library is deprecated the arguments will have to be passed through a map or something to the nogo rule itself.

Notes

Similar ask to #1867 but more straightforward in that no config file needs to be passed in. Though this solution doesn't seem particularly compatible with the use case mentioned in #1867 since the nogo config won't be able to reference Bazel sandboxed data deps, I think the config file use case is more exotic than typical usage patterns of Go analyzers in the wild, many of which consume flags. It would be good to support those common use cases first.

@FastNav FastNav changed the title Allow nogo to accept flags Allow nogo to accept analyzer-specific flags Mar 6, 2022
@linzhp linzhp closed this as completed in 1691291 Mar 26, 2022
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

No branches or pull requests

1 participant