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

Empty go.mod file in /tests: "missing module declaration" #3873

Open
mgingios opened this issue Feb 24, 2024 · 1 comment
Open

Empty go.mod file in /tests: "missing module declaration" #3873

mgingios opened this issue Feb 24, 2024 · 1 comment

Comments

@mgingios
Copy link

What version of rules_go are you using?

0.44.2

What version of gazelle are you using?

0.35.0

What version of Bazel are you using?

7.0.0

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

I cleaned my project and changed MODULE.bazel to use rules_go v0.46.0.
The error seems to be resolved. When I looked at the go.mod file for 0.46.0, it hasn't changed,
but there is a commit that seems to have corrected things. You might want to verify my
conclusion. Here is the commit: #3775

What operating system and processor architecture are you using?

macOS Sonoma, v 14.2.1
amd64

Any other potentially useful information about your toolchain?

go version go1.21.6 darwin/amd64

Goland Info:
GoLand 2023.3.4
Build #GO-233.14475.38, built on February 13, 2024
Runtime version: 17.0.10+1-b1087.17 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 14.2.1
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 24
Metal Rendering is ON
Registry:
debugger.new.tool.window.layout=true
ide.completion.variant.limit=500
suggest.all.run.configurations.from.context=true
ide.experimental.ui=true
Non-Bundled Plugins:
lechuck.intellij-plugin.task (1.5.0)
com.planetexpress.go_struct_tag_generator (1.2.8)
String Manipulation (9.12.0)
org.intellij.plugins.hcl (233.13135.65)
org.toml.lang (233.13135.67)
com.jetbrains.space (233.14475.8)
com.intellij.kubernetes (233.14475.2)

GOROOT=/usr/local/opt/go/libexec #gosetup
GOPATH=/Users/mike/Go #gosetup

What did you do?

When I open my golang project in JetBrains GoLand, something runs the following command:

/usr/local/opt/go/libexec/bin/go list -modfile=/Users/mike/Go/src/github.com/ingios/falcon/bazel-falcon/external/rules_go~0.44.2/tests/go.mod -m -json -mod=mod all #gosetup

When I look at the go.mod file in that directory, it is empty and does not have a module statement.

Here is the error in the window that ran that command:
go: error reading /Users/mike/Go/src/github.com/ingios/falcon/bazel-falcon/external/rules_go~0.44.2/tests/go.mod: missing module declaration. To specify the module path:
go mod edit -module=example.com/mod

What did you expect to see?

No error

What did you see instead?

The reported error

@eric-skydio
Copy link

eric-skydio commented Mar 27, 2024

I saw a similar error when Bazel's --output_base flag was set to a path inside my workspace. Upgrading to later rules_go versions did not seem to resolve it.

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

2 participants