bazel-contrib / bazel-contrib/rules_go

Using TOOLS_NOGO together with vet

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

Description

### What version of rules_go are you using?

v0.39.1

### What version of gazelle are you using?

v0.30.0

### What version of Bazel are you using?

v6.2.1

### Does this issue reproduce with the latest releases of all the above?

yes

### What operating system and processor architecture are you using?

x86_64

### Any other potentially useful information about your toolchain?

Just building go code.

### What did you do?

```bazel
nogo(
name = "nogo",
config = "nogo.json", # needed a config to exclude a few files
visibility = ["//visibility:public"],
deps = TOOLS_NOGO, # added all rules
vet = True, # enabled vet
)
```

### What did you expect to see?

I would expect Bazel to compile normally.

### What did you see instead?

The build fails due to duplicated dependencies. Perhaps the rule can do a better job by deduplicating dependencies.

```
ERROR: /usr/.../BUILD.bazel:12:5: Label '@org_golang_x_tools//go/analysis/passes/buildtag:go_default_library' is duplicated in the 'deps' attribute of rule 'nogo_actual'
ERROR: /usr/.../BUILD.bazel:12:5: Label '@org_golang_x_tools//go/analysis/passes/atomic:go_default_library' is duplicated in the 'deps' attribute of rule 'nogo_actual'
ERROR: /usr/.../BUILD.bazel:12:5: Label '@org_golang_x_tools//go/analysis/passes/printf:go_default_library' is duplicated in the 'deps' attribute of rule 'nogo_actual'
ERROR: /usr/.../BUILD.bazel:12:5: Label '@org_golang_x_tools//go/analysis/passes/bools:go_default_library' is duplicated in the 'deps' attribute of rule 'nogo_actual'
ERROR: /usr/.../BUILD.bazel:12:5: Label '@org_golang_x_tools//go/analysis/passes/nilfunc:go_default_library' is duplicated in the 'deps' attribute of rule 'nogo_actual'
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the shown nogo rule using TOOLS_NOGO and vet = True on Bazel 6.2.1. Start by locating the nogo rule implementation and its tests, then trace how deps from TOOLS_NOGO and vet are combined. Done means the configuration builds without duplicated analyzer dependency labels and existing behavior remains covered by tests.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.