-
Notifications
You must be signed in to change notification settings - Fork 17.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/go: in 'go build -o', allow the destination file to exist if it i…
…s empty This allows the target of 'go build' to be a filename constructed using ioutil.TempFile or similar, without racily deleting the file before rebuilding it. Updates #32407 Updates #28387 Change-Id: I4c5072830a02b93f0c4186b50bffa9de00257afe Reviewed-on: https://go-review.googlesource.com/c/go/+/206477 Run-TryBot: Bryan C. Mills <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
- Loading branch information
Bryan C. Mills
committed
Nov 11, 2019
1 parent
e9f8d67
commit c9a4b01
Showing
2 changed files
with
13 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[short] skip | ||
|
||
# Ensure that the target of 'go build -o' can be an existing, empty file so that | ||
# its name can be reserved using ioutil.TempFile or the 'mktemp` command. | ||
|
||
go build -o empty-file$GOEXE main.go | ||
|
||
-- main.go -- | ||
package main | ||
func main() {} | ||
-- empty-file$GOEXE -- |