From af05d8be3d9dd566b2ce3ff5344258314f128ff6 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 28 Oct 2021 13:51:39 -0400 Subject: [PATCH] all: manual fixups for //go:build vs // +build Update many generators, also handle files that were not part of the standard build during 'go fix' in CL 344955. Fixes #41184. Change-Id: I1edc684e8101882dcd11f75c6745c266fccfe9e7 Reviewed-on: https://go-review.googlesource.com/c/go/+/359476 Trust: Russ Cox Run-TryBot: Russ Cox Reviewed-by: Bryan C. Mills --- src/crypto/elliptic/gen_p256_table.go | 1 - src/internal/goarch/gengoarch.go | 3 +-- src/internal/goos/gengoos.go | 1 - src/internal/syscall/windows/exec_windows_test.go | 1 - src/internal/syscall/windows/mksyscall.go | 1 - src/internal/syscall/windows/registry/export_test.go | 1 - src/internal/syscall/windows/registry/key.go | 1 - src/internal/syscall/windows/registry/mksyscall.go | 1 - src/internal/syscall/windows/registry/registry_test.go | 1 - src/internal/syscall/windows/registry/syscall.go | 1 - src/internal/syscall/windows/registry/value.go | 1 - src/internal/syscall/windows/sysdll/sysdll.go | 1 - src/runtime/asan/asan.go | 3 --- src/runtime/mkduff.go | 2 -- src/runtime/mkpreempt.go | 1 - src/runtime/msan/msan.go | 3 --- src/runtime/wincallback.go | 1 - src/syscall/js/export_test.go | 1 - src/syscall/js/func.go | 1 - src/syscall/js/js.go | 1 - src/syscall/js/js_test.go | 1 - 21 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/crypto/elliptic/gen_p256_table.go b/src/crypto/elliptic/gen_p256_table.go index 54aafa2c38624..367bd4b67d924 100644 --- a/src/crypto/elliptic/gen_p256_table.go +++ b/src/crypto/elliptic/gen_p256_table.go @@ -26,7 +26,6 @@ func main() { // Generated by gen_p256_table.go. DO NOT EDIT. //go:build amd64 || arm64 -// +build amd64 arm64 package elliptic diff --git a/src/internal/goarch/gengoarch.go b/src/internal/goarch/gengoarch.go index d146cc5bc90a7..3c706e04ad0cc 100644 --- a/src/internal/goarch/gengoarch.go +++ b/src/internal/goarch/gengoarch.go @@ -39,8 +39,7 @@ func main() { } var buf bytes.Buffer fmt.Fprintf(&buf, "// Code generated by gengoarch.go using 'go generate'. DO NOT EDIT.\n\n") - fmt.Fprintf(&buf, "//go:build %s\n", target) - fmt.Fprintf(&buf, "// +build %s\n\n", target) // must explicitly include target for bootstrapping purposes + fmt.Fprintf(&buf, "//go:build %s\n", target) // must explicitly include target for bootstrapping purposes fmt.Fprintf(&buf, "package goarch\n\n") fmt.Fprintf(&buf, "const GOARCH = `%s`\n\n", target) for _, goarch := range goarches { diff --git a/src/internal/goos/gengoos.go b/src/internal/goos/gengoos.go index f8ddfcc7ff0ac..1b62503fd0074 100644 --- a/src/internal/goos/gengoos.go +++ b/src/internal/goos/gengoos.go @@ -51,7 +51,6 @@ func main() { var buf bytes.Buffer fmt.Fprintf(&buf, "// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.\n\n") fmt.Fprintf(&buf, "//go:build %s\n", strings.Join(tags, " && ")) - fmt.Fprintf(&buf, "// +build %s\n\n", strings.Join(tags, ",")) fmt.Fprintf(&buf, "package goos\n\n") fmt.Fprintf(&buf, "const GOOS = `%s`\n\n", target) for _, goos := range gooses { diff --git a/src/internal/syscall/windows/exec_windows_test.go b/src/internal/syscall/windows/exec_windows_test.go index 0db626636e95d..3311da5474164 100644 --- a/src/internal/syscall/windows/exec_windows_test.go +++ b/src/internal/syscall/windows/exec_windows_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows package windows_test diff --git a/src/internal/syscall/windows/mksyscall.go b/src/internal/syscall/windows/mksyscall.go index 39f745db7a3d4..81f08c627e649 100644 --- a/src/internal/syscall/windows/mksyscall.go +++ b/src/internal/syscall/windows/mksyscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build generate -// +build generate package windows diff --git a/src/internal/syscall/windows/registry/export_test.go b/src/internal/syscall/windows/registry/export_test.go index d02d93f287522..7f1ac70e8fa01 100644 --- a/src/internal/syscall/windows/registry/export_test.go +++ b/src/internal/syscall/windows/registry/export_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows package registry diff --git a/src/internal/syscall/windows/registry/key.go b/src/internal/syscall/windows/registry/key.go index ebe73a2e02468..ba5c292c5eca7 100644 --- a/src/internal/syscall/windows/registry/key.go +++ b/src/internal/syscall/windows/registry/key.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows // Package registry provides access to the Windows registry. // diff --git a/src/internal/syscall/windows/registry/mksyscall.go b/src/internal/syscall/windows/registry/mksyscall.go index 0a007df7ccd08..0e0b4210d58a0 100644 --- a/src/internal/syscall/windows/registry/mksyscall.go +++ b/src/internal/syscall/windows/registry/mksyscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build generate -// +build generate package registry diff --git a/src/internal/syscall/windows/registry/registry_test.go b/src/internal/syscall/windows/registry/registry_test.go index 69b84e1c4c5f9..134b5450fcace 100644 --- a/src/internal/syscall/windows/registry/registry_test.go +++ b/src/internal/syscall/windows/registry/registry_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows package registry_test diff --git a/src/internal/syscall/windows/registry/syscall.go b/src/internal/syscall/windows/registry/syscall.go index bb612793613f5..cb315adadedf7 100644 --- a/src/internal/syscall/windows/registry/syscall.go +++ b/src/internal/syscall/windows/registry/syscall.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows package registry diff --git a/src/internal/syscall/windows/registry/value.go b/src/internal/syscall/windows/registry/value.go index e1fc99c40d4cd..025574015f69e 100644 --- a/src/internal/syscall/windows/registry/value.go +++ b/src/internal/syscall/windows/registry/value.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows package registry diff --git a/src/internal/syscall/windows/sysdll/sysdll.go b/src/internal/syscall/windows/sysdll/sysdll.go index 61b998e4cfc3d..e79fd19edc0eb 100644 --- a/src/internal/syscall/windows/sysdll/sysdll.go +++ b/src/internal/syscall/windows/sysdll/sysdll.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build windows -// +build windows // Package sysdll is an internal leaf package that records and reports // which Windows DLL names are used by Go itself. These DLLs are then diff --git a/src/runtime/asan/asan.go b/src/runtime/asan/asan.go index 40ebf96824029..ac71466b71d46 100644 --- a/src/runtime/asan/asan.go +++ b/src/runtime/asan/asan.go @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build asan && linux && (arm64 || amd64) -// +build asan -// +build linux -// +build arm64 amd64 package asan diff --git a/src/runtime/mkduff.go b/src/runtime/mkduff.go index d05158975fc44..e8a85702c6088 100644 --- a/src/runtime/mkduff.go +++ b/src/runtime/mkduff.go @@ -179,7 +179,6 @@ func copyARM64(w io.Writer) { func tagsPPC64x(w io.Writer) { fmt.Fprintln(w) fmt.Fprintln(w, "//go:build ppc64 || ppc64le") - fmt.Fprintln(w, "// +build ppc64 ppc64le") fmt.Fprintln(w) } @@ -207,7 +206,6 @@ func copyPPC64x(w io.Writer) { func tagsMIPS64x(w io.Writer) { fmt.Fprintln(w) fmt.Fprintln(w, "//go:build mips64 || mips64le") - fmt.Fprintln(w, "// +build mips64 mips64le") fmt.Fprintln(w) } diff --git a/src/runtime/mkpreempt.go b/src/runtime/mkpreempt.go index acfb518d10680..d662e73813ff8 100644 --- a/src/runtime/mkpreempt.go +++ b/src/runtime/mkpreempt.go @@ -123,7 +123,6 @@ func header(arch string) { if beLe[arch] { base := arch[:len(arch)-1] fmt.Fprintf(out, "//go:build %s || %sle\n", base, base) - fmt.Fprintf(out, "// +build %s %sle\n\n", base, base) } fmt.Fprintf(out, "#include \"go_asm.h\"\n") fmt.Fprintf(out, "#include \"textflag.h\"\n\n") diff --git a/src/runtime/msan/msan.go b/src/runtime/msan/msan.go index 9908a8ec22170..f1bf4e1065cf9 100644 --- a/src/runtime/msan/msan.go +++ b/src/runtime/msan/msan.go @@ -3,9 +3,6 @@ // license that can be found in the LICENSE file. //go:build msan && linux && (amd64 || arm64) -// +build msan -// +build linux -// +build amd64 arm64 package msan diff --git a/src/runtime/wincallback.go b/src/runtime/wincallback.go index ca9965979fd30..442a98470837b 100644 --- a/src/runtime/wincallback.go +++ b/src/runtime/wincallback.go @@ -22,7 +22,6 @@ func genasm386Amd64() { buf.WriteString(`// Code generated by wincallback.go using 'go generate'. DO NOT EDIT. //go:build 386 || amd64 -// +build 386 amd64 // runtime·callbackasm is called by external code to // execute Go implemented callback function. It is not diff --git a/src/syscall/js/export_test.go b/src/syscall/js/export_test.go index 4bd9c5d595eb7..fb61daea7cea0 100644 --- a/src/syscall/js/export_test.go +++ b/src/syscall/js/export_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build js && wasm -// +build js,wasm package js diff --git a/src/syscall/js/func.go b/src/syscall/js/func.go index dde1e6810023b..77fb9e66ca91f 100644 --- a/src/syscall/js/func.go +++ b/src/syscall/js/func.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build js && wasm -// +build js,wasm package js diff --git a/src/syscall/js/js.go b/src/syscall/js/js.go index 0da0ddfa0fbbd..d80d5d63de2a5 100644 --- a/src/syscall/js/js.go +++ b/src/syscall/js/js.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build js && wasm -// +build js,wasm // Package js gives access to the WebAssembly host environment when using the js/wasm architecture. // Its API is based on JavaScript semantics. diff --git a/src/syscall/js/js_test.go b/src/syscall/js/js_test.go index 8088a897f6071..fa8c782459c42 100644 --- a/src/syscall/js/js_test.go +++ b/src/syscall/js/js_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build js && wasm -// +build js,wasm // To run these tests: //