cmd/go: 'build -o' overwrite behavior differs between Linux and Windows #30837
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
OS-Windows
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What did you do?
When exec "build -o dst_file" on windows casually, i got an error:
go build go-test: build output "dst_file" already exists and is not an object file.
I found dst_file allready exists and is an empty file,but it works on linux in the same case.
After reviewed code related build, I found the code snippet:
b.moveOrCopyFile(a.Target, a1.built, perm, false)
force is false, and moveOrCopyFile rename src to dst on linux, and not check the param force.
What did you expect to see?
It should be the same on different os, I think param force should be retain semantically, eg:
Can someone give me some advice?
:) thanks.
The text was updated successfully, but these errors were encountered: