cmd/gomote: fix inconsistencies in push exclusion list handling
The code that avoids pushing files that are generated by "go tool
dist" was missing an entry in one case and missing a bunch of entries
in another case. This resulted in "linked object header mismatch"
errors when doign repeated rebuilds of the linkerk after running
make.bash/make.bat on the gomote. This patch resolves the problem by
commoning up the exclusion list checking code into a helper function
and adding in the missing file entry.
Fixes golang/go#53221.
Change-Id: Ibf6b14a91c0d384be7887ad74c3f9f1dba3c9784
Reviewed-on: https://go-review.googlesource.com/c/build/+/410238
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Than McIntosh <thanm@google.com>
diff --git a/cmd/gomote/push.go b/cmd/gomote/push.go
index c6680b8..8aa024b 100644
--- a/cmd/gomote/push.go
+++ b/cmd/gomote/push.go
@@ -207,13 +207,7 @@
// -- gomote run go test -v ...
// Because the go test would fail remotely without
// these files if they were deleted by gomote push.
- switch rel {
- case "src/cmd/cgo/zdefaultcc.go",
- "src/cmd/go/internal/cfg/zdefaultcc.go",
- "src/cmd/go/internal/cfg/zosarch.go",
- "src/cmd/internal/objabi/zbootstrap.go",
- "src/go/build/zcgo.go",
- "src/runtime/internal/sys/zversion.go":
+ if isGoToolDistGenerated(rel) {
continue
}
if isGitIgnored(rel) {
@@ -248,9 +242,7 @@
notHave := 0
const maxNotHavePrint = 5
for rel, inf := range local {
- switch rel {
- case "VERSION.cache", "src/runtime/internal/sys/zversion.go", "src/cmd/internal/objabi/zbootstrap.go",
- "src/go/build/zcgo.go":
+ if isGoToolDistGenerated(rel) || rel == "VERSION.cache" {
continue
}
if !inf.fi.Mode().IsRegular() {
@@ -300,6 +292,20 @@
return nil
}
+func isGoToolDistGenerated(path string) bool {
+ switch path {
+ case "src/cmd/cgo/zdefaultcc.go",
+ "src/cmd/go/internal/cfg/zdefaultcc.go",
+ "src/cmd/go/internal/cfg/zosarch.go",
+ "src/cmd/internal/objabi/zbootstrap.go",
+ "src/go/build/zcgo.go",
+ "src/internal/buildcfg/zbootstrap.go",
+ "src/runtime/internal/sys/zversion.go":
+ return true
+ }
+ return false
+}
+
func isEditorBackup(path string) bool {
base := filepath.Base(path)
if strings.HasPrefix(base, ".") && strings.HasSuffix(base, ".swp") {