-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/go: inconsistent result when go build output is a non-existent directory #41313
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
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Comments
XSAM
added a commit
to XSAM/go
that referenced
this issue
Sep 10, 2020
`go build` will complain that output is a inexistent directory, but also creates that directory. It makes a inconsistent result since building will pass in the next time. By checking output with directory convention, allow building output is not a exists directory, we can fix the issue and bring more conveniences for users. Fixes golang#41313
XSAM
added a commit
to XSAM/go
that referenced
this issue
Sep 10, 2020
`go build` will complain that output is an inexistent directory, but also creates that directory. It makes an inconsistent result since the building will pass next time. By checking output with directory convention, allow building output is not a exists directory, we can fix the issue and bring more conveniences for users. Fixes golang#41313
XSAM
added a commit
to XSAM/go
that referenced
this issue
Sep 10, 2020
`go build` will complain that output is an inexistent directory, but also creates that directory. It makes an inconsistent result since the building will pass next time. By checking output with directory convention, allow building output is not a exists directory, we can fix the issue and bring more conveniences for users. Fixes golang#41313
Change https://golang.org/cl/253821 mentions this issue: |
XSAM
added a commit
to XSAM/go
that referenced
this issue
Sep 14, 2020
When 'go build' is given an output path with -o, if the output path ends with a path separator, always treat it as a directory. Fixes golang#41313
XSAM
added a commit
to XSAM/go
that referenced
this issue
Sep 17, 2020
When 'go build' is given an output path with -o, if the output path ends with a path separator, always treat it as a directory. Fixes golang#41313
sergystepanov
added a commit
to giongto35/cloud-game
that referenced
this issue
Aug 27, 2021
If you specify just an output path without a filename when building the app, it will say that "build output dir/ already exists and is a directory" then it'll crash the build process. This is considered as a bug (golang/go#41313) and was fixed in Go 1.16. The fix is for older versions.
sergystepanov
added a commit
to giongto35/cloud-game
that referenced
this issue
Aug 27, 2021
If you specify just an output path without a filename when building the app, it will say that "build output dir/ already exists and is a directory" then it'll crash the build process. This is considered as a bug (golang/go#41313) and was fixed in Go 1.16. The fix is for older versions.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?go1.15 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What did you do?
Project Hierarchy
The first time to build,
go
complain about an existent directory that is actually created bygo
itself and not exists before the build.$ go build -o bin/ main.go go build command-line-arguments: build output "bin/" already exists and is a directory
Project Hierarchy
The second time to build. Since the directory already exists,
go
works fine at this time.Project Hierarchy
What did you expect to see?
An idempotent result from
go build
.go build
output is an inexistent directoryI prefer the second solution since it's more convenient for users.
Pros:
Before:
go build -o bin/foo .
go build -o bin/bar .
(We need to change the output name)After:
go build -o bin/ .
go build -o bin/foo .
also creates the directory for users.The text was updated successfully, but these errors were encountered: