cmd/go: go build ./... may or may not write executable to disk depending how many packages the import path pattern matches #39515
Labels
GoCommand
cmd/go
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Issue is reproduced with the latest release.
What operating system and processor architecture are you using (
go env
)?OS: macOS Catalina (10.15.5)
go env
OutputWhat did you do?
I am trying to build a go module using
go build ./...
in the same directory asgo.mod
. It works fine when there's only a single go package (main) and file. But adding another package and file, referencing those functions in main, and executing the aforementioned command does not generate the executable.I have a very basic go project that reproduces this issue (includes instructions): https://github.com/xyzst/go-build-bug
What did you expect to see?
An executable should be generated in the same directory as
go.mod
What did you see instead?
The binary is not generated and I am not able to locate it anywhere.
There are workarounds available:
go install ./...
still works as intended and the binary is found in the expected location at$GOPATH/bin
go build ./path/to/go/file/with/mainpkg.go
will generate the binary as expectedThe text was updated successfully, but these errors were encountered: