You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
foo exists and is a directory, therefore cmd/foo's resultant binary is placed inside the foo directory
In the actual project I'm working on, I occasionally run go build ./cmd/foo to ensure that foo builds correctly, and I expect no binary to be built because the foo directory exists. I was surprised that tip actually created ./foo/foo. I would run go build ./cmd/... to achieve the same thing but there are a lot of commands in this particular project, so go build ./cmd/foo is more to the point.
Reading the comments in the CL, looking at the tests introduced in the CL, and reading through the comments in #14295, it doesn't look like this behavior was intended.
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
No, it does not reproduce with go 1.12.2.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Given a layout with files like this, noting that there a main package inside
cmd/foo
and a top-level directoryfoo
:Then running
go build ./cmd/foo
now creates the binary to./foo/foo
whereas it was previously rejected:What did you expect to see?
I expected an error like the output in go.1.12.2 about the foo directory existing, and no binary being built:
What did you see instead?
A successful build that placed an executable into
./foo/foo
.I haven't bisected, but I'm guessing https://go-review.googlesource.com/c/go/+/167679/ (b48bda9) introduced this behavior, where:
-o
-o foo
foo
exists and is a directory, therefore cmd/foo's resultant binary is placed inside the foo directoryIn the actual project I'm working on, I occasionally run
go build ./cmd/foo
to ensure that foo builds correctly, and I expect no binary to be built because the foo directory exists. I was surprised that tip actually created./foo/foo
. I would rungo build ./cmd/...
to achieve the same thing but there are a lot of commands in this particular project, sogo build ./cmd/foo
is more to the point.Reading the comments in the CL, looking at the tests introduced in the CL, and reading through the comments in #14295, it doesn't look like this behavior was intended.
The text was updated successfully, but these errors were encountered: