bazel-contrib / bazel-contrib/rules_go

code generated with `import x "."` fails strict deps checks

Open
#1,865 3 comments 0 reactions 0 assignees View on GitHub
bug go
Dominant language
Go
Stars
1.5k
Forks
762
Avg merge
1d 11h
Merged PRs (30d)
12

Description

Current versions of mockgen (and probably other tools) generate code with imports like:

```
import (
x "."
...
)
```

That isn't allowed by rules_go's strict dependencies check, but doesn't actually require a new dependency.

Example error:

```
GoCompile: missing strict dependencies:
/private/var/tmp/_bazel_jmhodges/ee957dabdee1b1a9e1f2fe90369cf80f/sandbox/darwin-sandbox/685/execroot/founding/bazel-out/darwin-fastbuild/bin/go/path/to/mock_test.go: import of "."
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the strict-dependencies failure from the generated mock_test.go example using mockgen output containing import ".". Trace how rules_go processes that import during GoCompile and determine why it is treated as a missing dependency. Done means generated code with this import passes strict dependency checks without requiring a new dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.