mirror of
https://github.com/golang/go
synced 2024-11-23 08:10:03 -07:00
cmd/dist: make zosarch.go deterministic
Currently zosarch.go is written out in non-deterministic map order. Sort the keys and write it out in sorted order to make the generated file contents deterministic. Change-Id: Id490f0e8665a2c619c5a7a00a30f4fc64f333258 Reviewed-on: https://go-review.googlesource.com/24174 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
c3818e56d0
commit
79f2f008a3
13
src/cmd/dist/buildgo.go
vendored
13
src/cmd/dist/buildgo.go
vendored
@ -42,10 +42,21 @@ func mkzdefaultcc(dir, file string) {
|
||||
|
||||
// mkzcgo writes zosarch.go for cmd/go.
|
||||
func mkzosarch(dir, file string) {
|
||||
// sort for deterministic zosarch.go file
|
||||
var list []string
|
||||
for plat := range cgoEnabled {
|
||||
list = append(list, plat)
|
||||
}
|
||||
sort.Strings(list)
|
||||
|
||||
var buf bytes.Buffer
|
||||
buf.WriteString("// auto generated by go tool dist\n\n")
|
||||
buf.WriteString("package main\n\n")
|
||||
fmt.Fprintf(&buf, "var osArchSupportsCgo = %#v", cgoEnabled)
|
||||
fmt.Fprintf(&buf, "var osArchSupportsCgo = map[string]bool{\n")
|
||||
for _, plat := range list {
|
||||
fmt.Fprintf(&buf, "\t%q: %v,\n", plat, cgoEnabled[plat])
|
||||
}
|
||||
fmt.Fprintf(&buf, "}\n")
|
||||
writefile(buf.String(), file, writeSkipSame)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user