mirror of
https://github.com/golang/go
synced 2024-10-03 17:11:21 -06:00
cmd/dist: use standard generated code header
This belongs to a series of clean-up changes (see below) for cmd/dist. This is change (4). These changes include: (1) apply minor fixes (2) restore behavior of branchtag (3) unleash bootstrap optimization for windows (4) use standard generated code header (5) remove trivial variables + functions (6) move functions for the better (7) simplify code segments (8) use bytes.Buffer for code generation (9) rename variables + functions (10) remove doc.go Change-Id: I5e163f89a518f074e58bf2d44597e553c918d7e6 Reviewed-on: https://go-review.googlesource.com/61010 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
fe2f509084
commit
e86c0676cf
8
src/cmd/dist/buildgo.go
vendored
8
src/cmd/dist/buildgo.go
vendored
@ -26,7 +26,7 @@ import (
|
|||||||
// but we also write cmd/cgo/zdefaultcc.go
|
// but we also write cmd/cgo/zdefaultcc.go
|
||||||
func mkzdefaultcc(dir, file string) {
|
func mkzdefaultcc(dir, file string) {
|
||||||
outGo := fmt.Sprintf(
|
outGo := fmt.Sprintf(
|
||||||
"// auto generated by go tool dist\n"+
|
"// Code generated by go tool dist; DO NOT EDIT.\n"+
|
||||||
"\n"+
|
"\n"+
|
||||||
"package cfg\n"+
|
"package cfg\n"+
|
||||||
"\n"+
|
"\n"+
|
||||||
@ -39,7 +39,7 @@ func mkzdefaultcc(dir, file string) {
|
|||||||
|
|
||||||
// Convert file name to replace: turn go/internal/cfg into cgo.
|
// Convert file name to replace: turn go/internal/cfg into cgo.
|
||||||
outCgo := fmt.Sprintf(
|
outCgo := fmt.Sprintf(
|
||||||
"// auto generated by go tool dist\n"+
|
"// Code generated by go tool dist; DO NOT EDIT.\n"+
|
||||||
"\n"+
|
"\n"+
|
||||||
"package main\n"+
|
"package main\n"+
|
||||||
"\n"+
|
"\n"+
|
||||||
@ -63,7 +63,7 @@ func mkzosarch(dir, file string) {
|
|||||||
sort.Strings(list)
|
sort.Strings(list)
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
buf.WriteString("// auto generated by go tool dist\n\n")
|
buf.WriteString("// Code generated by go tool dist; DO NOT EDIT.\n\n")
|
||||||
buf.WriteString("package cfg\n\n")
|
buf.WriteString("package cfg\n\n")
|
||||||
fmt.Fprintf(&buf, "var OSArchSupportsCgo = map[string]bool{\n")
|
fmt.Fprintf(&buf, "var OSArchSupportsCgo = map[string]bool{\n")
|
||||||
for _, plat := range list {
|
for _, plat := range list {
|
||||||
@ -92,7 +92,7 @@ func mkzcgo(dir, file string) {
|
|||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
|
|
||||||
fmt.Fprintf(&buf,
|
fmt.Fprintf(&buf,
|
||||||
"// auto generated by go tool dist\n"+
|
"// Code generated by go tool dist; DO NOT EDIT.\n"+
|
||||||
"\n"+
|
"\n"+
|
||||||
"package build\n"+
|
"package build\n"+
|
||||||
"\n"+
|
"\n"+
|
||||||
|
4
src/cmd/dist/buildruntime.go
vendored
4
src/cmd/dist/buildruntime.go
vendored
@ -24,7 +24,7 @@ import (
|
|||||||
//
|
//
|
||||||
func mkzversion(dir, file string) {
|
func mkzversion(dir, file string) {
|
||||||
out := fmt.Sprintf(
|
out := fmt.Sprintf(
|
||||||
"// auto generated by go tool dist\n"+
|
"// Code generated by go tool dist; DO NOT EDIT.\n"+
|
||||||
"\n"+
|
"\n"+
|
||||||
"package sys\n"+
|
"package sys\n"+
|
||||||
"\n"+
|
"\n"+
|
||||||
@ -61,7 +61,7 @@ func mkzversion(dir, file string) {
|
|||||||
// original target (in this example, a Mac).
|
// original target (in this example, a Mac).
|
||||||
func mkzbootstrap(file string) {
|
func mkzbootstrap(file string) {
|
||||||
out := fmt.Sprintf(
|
out := fmt.Sprintf(
|
||||||
"// auto generated by go tool dist\n"+
|
"// Code generated by go tool dist; DO NOT EDIT.\n"+
|
||||||
"\n"+
|
"\n"+
|
||||||
"package objabi\n"+
|
"package objabi\n"+
|
||||||
"\n"+
|
"\n"+
|
||||||
|
6
src/cmd/dist/buildtool.go
vendored
6
src/cmd/dist/buildtool.go
vendored
@ -227,7 +227,9 @@ func bootstrapRewriteFile(text, srcFile string) string {
|
|||||||
// binary that works for the current runtime.GOARCH.
|
// binary that works for the current runtime.GOARCH.
|
||||||
// This saves 6+ seconds of bootstrap.
|
// This saves 6+ seconds of bootstrap.
|
||||||
if archCaps, ok := isUnneededSSARewriteFile(srcFile); ok {
|
if archCaps, ok := isUnneededSSARewriteFile(srcFile); ok {
|
||||||
return fmt.Sprintf(`package ssa
|
return fmt.Sprintf(`// Code generated by go tool dist; DO NOT EDIT.
|
||||||
|
|
||||||
|
package ssa
|
||||||
|
|
||||||
func rewriteValue%s(v *Value) bool { panic("unused during bootstrap") }
|
func rewriteValue%s(v *Value) bool { panic("unused during bootstrap") }
|
||||||
func rewriteBlock%s(b *Block) bool { panic("unused during bootstrap") }
|
func rewriteBlock%s(b *Block) bool { panic("unused during bootstrap") }
|
||||||
@ -262,7 +264,7 @@ func bootstrapFixImports(text, srcFile string) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lines[0] = "// Do not edit. Bootstrap copy of " + srcFile + "\n\n//line " + srcFile + ":1\n" + lines[0]
|
lines[0] = "// Code generated by go tool dist; DO NOT EDIT.\n// This is a bootstrap copy of " + srcFile + "\n\n//line " + srcFile + ":1\n" + lines[0]
|
||||||
|
|
||||||
return strings.Join(lines, "")
|
return strings.Join(lines, "")
|
||||||
}
|
}
|
||||||
|
2
src/cmd/dist/deps.go
vendored
2
src/cmd/dist/deps.go
vendored
@ -1,4 +1,4 @@
|
|||||||
// generated by mkdeps.bash
|
// Code generated by mkdeps.bash; DO NOT EDIT.
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
2
src/cmd/dist/mkdeps.bash
vendored
2
src/cmd/dist/mkdeps.bash
vendored
@ -32,7 +32,7 @@ all="$(deps_of cmd/go | awk '{print $2}') cmd/go"
|
|||||||
deps_of $all >tmp.all.deps
|
deps_of $all >tmp.all.deps
|
||||||
|
|
||||||
(
|
(
|
||||||
echo '// generated by mkdeps.bash'
|
echo '// Code generated by mkdeps.bash; DO NOT EDIT.'
|
||||||
echo
|
echo
|
||||||
echo 'package main'
|
echo 'package main'
|
||||||
echo
|
echo
|
||||||
|
Loading…
Reference in New Issue
Block a user