bazel-contrib / bazel-contrib/rules_go

GOPACKAGEDRIVERS generates an "invalid use of internal package" false positive when testing an internal package.

Open
#3,845 4 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

### What version of rules_go are you using?

v0.42.0

### What version of gazelle are you using?

v0.34.0

### What version of Bazel are you using?

7.0.2

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

Yes

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

Fedora workstation 39 amd64

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

Clang LLVM 16

### What did you do?

Add a black-box test to an internal package.

Note: Only happens when GOPACKAGESDRIVER is used and the package name is "mypackage_test" if I change the package name to "mypackage" then the error disappears.

### What did you expect to see?

No errors in my imports.

### What did you see instead?

An "invalid use of internal package" error in my imports.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported case with GOPACKAGESDRIVER: a black-box test in an internal package named mypackage_test, then compare it with mypackage. Trace the GOPACKAGESDRIVER handling of the internal-package import and verify the fix no longer reports an invalid-use error while preserving the expected import checks.

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.