Open
Description
In #66109, we see gopls running into a latent go/packages bug.
Consider the following setup (taken from the gopls regression test for that issue):
-- go.mod --
module example.com/tools
go 1.22
-- tools_test.go --
//go:build tools
package tools
import (
_ "example.com/tools/tool"
)
-- tool/tool.go --
package main
func main() {
}
In this case, gopackages -test -json -deps ./tools_test.go
will report a package "command-line-arguments [command-line-arguments.test]"
with the nonsensical dependency ID "example.com/tools/tool [command-line-arguments.test]"
. This only occurs if the dep is a main
package itself. It looks like go/packages thinks it has to break a cycle to the non-existent command-line-arguments
package.