mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-31 22:36:44 -04:00
unix: add //go:build lines when generating files
The //+go:build lines were added by running Go 1.17 gofmt in CL 294490. Make sure to retain them when re-generating files in this package. For golang/go#41184. Change-Id: Ia418b8c0eb4291a0db3f4bb97685bde78d0ff016 Reviewed-on: https://go-review.googlesource.com/c/sys/+/296889 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
committed by
Tobias Klauser
parent
94ec62e081
commit
68d13333fa
@@ -598,6 +598,7 @@ func generatePtracePair(arch1, arch2, archName string) error {
|
||||
buf := bufio.NewWriter(f)
|
||||
fmt.Fprintf(buf, "// Code generated by linux/mkall.go generatePtracePair(%q, %q). DO NOT EDIT.\n", arch1, arch2)
|
||||
fmt.Fprintf(buf, "\n")
|
||||
fmt.Fprintf(buf, "//go:build linux && (%s || %s)\n", arch1, arch2)
|
||||
fmt.Fprintf(buf, "// +build linux\n")
|
||||
fmt.Fprintf(buf, "// +build %s %s\n", arch1, arch2)
|
||||
fmt.Fprintf(buf, "\n")
|
||||
|
||||
@@ -25,8 +25,13 @@ func cmdLine() string {
|
||||
return "go run linux/mksysnum.go " + strings.Join(os.Args[1:], " ")
|
||||
}
|
||||
|
||||
// buildTags returns build tags
|
||||
func buildTags() string {
|
||||
// goBuildTags returns build tags in the go:build format.
|
||||
func goBuildTags() string {
|
||||
return fmt.Sprintf("%s && %s", goarch, goos)
|
||||
}
|
||||
|
||||
// plusBuildTags returns build tags in the +build format.
|
||||
func plusBuildTags() string {
|
||||
return fmt.Sprintf("%s,%s", goarch, goos)
|
||||
}
|
||||
|
||||
@@ -129,12 +134,13 @@ func main() {
|
||||
}
|
||||
err = s.Err()
|
||||
checkErr(err)
|
||||
fmt.Printf(template, cmdLine(), buildTags(), text)
|
||||
fmt.Printf(template, cmdLine(), goBuildTags(), plusBuildTags(), text)
|
||||
}
|
||||
|
||||
const template = `// %s
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
//go:build %s
|
||||
// +build %s
|
||||
|
||||
package unix
|
||||
|
||||
Reference in New Issue
Block a user