bazel-contrib / bazel-contrib/rules_go

Allow duplicate analyzer flags in nogo configuration

Open
#4,354 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.5k
Forks
760
Avg merge
1d 11h
Merged PRs (30d)
12

Description

Our nogo config looks like this:
```
nogo(
name = "lint",
"importas": {
"analyzer_flags": {
# TODO: figure out how to pass more than one alias flag here :-/
"alias": "foo.com/package/errors:fooerr",
},
},
},
...
)
```

The [mportas](https://github.com/julz/importas) linter accepts multiple `-alias` flags to enforce different import alias mappings, but there does't appear to be a way to specify that in nogo.

importas usage:
```
importas \
-alias knative.dev/serving/pkg/apis/autoscaling/v1alpha1:autoscalingv1alpha1 \
-alias knative.dev/serving/pkg/apis/serving/v1:servingv1 \
./...
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing how nogo's analyzer_flags configuration is translated into command-line arguments, using the shown importas invocation as the expected behavior. Determine how multiple alias mappings can be represented, and consider the work complete when a nogo configuration can pass multiple -alias flags to importas.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.