cmd/go: inconsistency when go build -o is a file or directory #37379
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go build -o path
behave differently whenpath
is a file or directory.As an example,
go build -o file ./pkg
, will build an executable ifpkg
is a main package or an archive otherwise.On the other hand,
go build -o dir ./...
, will build all the main packages, saving the files in the build directory, using the last segment of the importpath as the name. This is done even if two executable happen to have the same name, without any notice.For consistency,
go build -o dir ./...
should save the archive files in the build directory, when processing non main packages, using the same algorithm used for main packages.I suspect that building an archive file is here only for compatibility reason.
The text was updated successfully, but these errors were encountered: