Commit e86c0676 authored by Marvin Stenger's avatar Marvin Stenger Committed by Ian Lance Taylor

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: default avatarIan Lance Taylor <iant@golang.org>
parent fe2f5090
......@@ -26,7 +26,7 @@ import (
// but we also write cmd/cgo/zdefaultcc.go
func mkzdefaultcc(dir, file string) {
outGo := fmt.Sprintf(
"// auto generated by go tool dist\n"+
"// Code generated by go tool dist; DO NOT EDIT.\n"+
"\n"+
"package cfg\n"+
"\n"+
......@@ -39,7 +39,7 @@ func mkzdefaultcc(dir, file string) {
// Convert file name to replace: turn go/internal/cfg into cgo.
outCgo := fmt.Sprintf(
"// auto generated by go tool dist\n"+
"// Code generated by go tool dist; DO NOT EDIT.\n"+
"\n"+
"package main\n"+
"\n"+
......@@ -63,7 +63,7 @@ func mkzosarch(dir, file string) {
sort.Strings(list)
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")
fmt.Fprintf(&buf, "var OSArchSupportsCgo = map[string]bool{\n")
for _, plat := range list {
......@@ -92,7 +92,7 @@ func mkzcgo(dir, file string) {
var buf bytes.Buffer
fmt.Fprintf(&buf,
"// auto generated by go tool dist\n"+
"// Code generated by go tool dist; DO NOT EDIT.\n"+
"\n"+
"package build\n"+
"\n"+
......
......@@ -24,7 +24,7 @@ import (
//
func mkzversion(dir, file string) {
out := fmt.Sprintf(
"// auto generated by go tool dist\n"+
"// Code generated by go tool dist; DO NOT EDIT.\n"+
"\n"+
"package sys\n"+
"\n"+
......@@ -61,7 +61,7 @@ func mkzversion(dir, file string) {
// original target (in this example, a Mac).
func mkzbootstrap(file string) {
out := fmt.Sprintf(
"// auto generated by go tool dist\n"+
"// Code generated by go tool dist; DO NOT EDIT.\n"+
"\n"+
"package objabi\n"+
"\n"+
......
......@@ -227,7 +227,9 @@ func bootstrapRewriteFile(text, srcFile string) string {
// binary that works for the current runtime.GOARCH.
// This saves 6+ seconds of bootstrap.
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 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, "")
}
// generated by mkdeps.bash
// Code generated by mkdeps.bash; DO NOT EDIT.
package main
......
......@@ -32,7 +32,7 @@ all="$(deps_of cmd/go | awk '{print $2}') cmd/go"
deps_of $all >tmp.all.deps
(
echo '// generated by mkdeps.bash'
echo '// Code generated by mkdeps.bash; DO NOT EDIT.'
echo
echo 'package main'
echo
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment