]> Cypherpunks repositories - gostls13.git/commit
cmd/go: check if build output should overwrite files with renames
authorSean Liao <sean@liao.dev>
Sun, 19 Oct 2025 19:00:55 +0000 (20:00 +0100)
committerSean Liao <sean@liao.dev>
Wed, 22 Oct 2025 20:35:02 +0000 (13:35 -0700)
commit7c9fa4d5e9b65be396d7794f645b1f409a9bc39f
tree1012bdbb5dc26ba65e995787853fdfd92603ebc8
parent557b4d6e0f9de96ce9718f89773f14e6e1b14760
cmd/go: check if build output should overwrite files with renames

CopyFile has a check to ensure that only object files are overwritten.
Extend this to moveOrCopyFile, so the check also happens when the source
and destination file are on the same filesystem (when renames are a
valid way of moving files).

Fixes #75970

Change-Id: Ie667301f1c9c00b114cfd91cdf8053ac20fd817b
Reviewed-on: https://go-review.googlesource.com/c/go/+/712960
Reviewed-by: Laurent Demailly <ldemailly@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Ian Alexander <jitsu@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
src/cmd/go/internal/work/shell.go
src/cmd/go/testdata/script/build_output_overwrite.txt [new file with mode: 0644]