From 98f3d7fecbb8a9074f5f4ffc50bb016e194940b7 Mon Sep 17 00:00:00 2001
From: Dmitri Shuralyov <dmitshur@golang.org>
Date: Mon, 9 Aug 2021 20:29:14 -0400
Subject: [PATCH] all: gofmt more (but vendor, testdata, and top-level test
 directories)

CL 294430 made packages in std and cmd modules use Go 1.17 gofmt format,
adding //go:build lines. This change applies the same formatting to some
more packages that 'go fmt' missed (e.g., syscall/js, runtime/msan), and
everything else that is easy and safe to modify in bulk.

Consider the top-level test directory, testdata, and vendor directories
out of scope, since there are many files that don't follow strict gofmt
formatting, often for intentional and legitimate reasons (testing gofmt
itself, invalid Go programs that shouldn't crash the compiler, etc.).

That makes it easy and safe to gofmt -w the .go files that are found
with gofmt -l with aforementioned directories filtered out:

	$ gofmt -l . 2>/dev/null | \
		grep -v '^test/' | \
		grep -v '/testdata/' | \
		grep -v '/vendor/' | wc -l
	      51

None of the 51 files are generated. After this change, the same command
prints 0.

For #41184.

Change-Id: Ia96ee2a0f998d6a167d4473bcad17ad09bc1d86e
Reviewed-on: https://go-review.googlesource.com/c/go/+/341009
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
---
 misc/android/go_android_exec.go                        | 1 +
 misc/cgo/gmp/fib.go                                    | 1 +
 misc/cgo/gmp/pi.go                                     | 1 +
 misc/cgo/test/cgo_thread_lock.go                       | 1 +
 misc/cgo/test/cgo_unix_test.go                         | 1 +
 misc/cgo/test/issue1435.go                             | 1 +
 misc/cgo/test/issue18146.go                            | 1 +
 misc/cgo/test/issue21897.go                            | 1 +
 misc/cgo/test/issue21897b.go                           | 1 +
 misc/cgo/test/issue4029.go                             | 4 +++-
 misc/cgo/test/issue4029w.go                            | 1 +
 misc/cgo/test/issue6997_linux.go                       | 1 +
 misc/cgo/test/issue8517.go                             | 1 +
 misc/cgo/test/issue8694.go                             | 1 +
 misc/cgo/test/sigaltstack.go                           | 1 +
 misc/cgo/test/sigprocmask.go                           | 1 +
 misc/cgo/test/test_unix.go                             | 1 +
 misc/cgo/testso/noso_test.go                           | 1 +
 misc/cgo/testso/so_test.go                             | 1 +
 misc/cgo/testsovar/noso_test.go                        | 1 +
 misc/cgo/testsovar/so_test.go                          | 1 +
 misc/cgo/testtls/tls_test.go                           | 1 +
 misc/ios/detect.go                                     | 1 +
 misc/reboot/experiment_toolid_test.go                  | 1 +
 src/cmd/compile/internal/base/bootstrap_false.go       | 1 +
 src/cmd/compile/internal/base/bootstrap_true.go        | 1 +
 src/cmd/compile/internal/noder/frames_go1.go           | 1 +
 src/cmd/compile/internal/noder/frames_go17.go          | 1 +
 src/cmd/compile/internal/ssa/gen/386Ops.go             | 1 +
 src/cmd/compile/internal/ssa/gen/MIPS64Ops.go          | 1 +
 src/cmd/compile/internal/ssa/gen/MIPSOps.go            | 1 +
 src/cmd/compile/internal/ssa/gen/PPC64Ops.go           | 1 +
 src/cmd/compile/internal/ssa/gen/RISCV64Ops.go         | 1 +
 src/cmd/compile/internal/ssa/gen/S390XOps.go           | 1 +
 src/cmd/compile/internal/ssa/gen/WasmOps.go            | 1 +
 src/cmd/compile/internal/ssa/gen/dec64Ops.go           | 1 +
 src/cmd/compile/internal/ssa/gen/decOps.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/msan/msan.go                               | 4 +++-
 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 +
 51 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/misc/android/go_android_exec.go b/misc/android/go_android_exec.go
index 3af2bee5839..168ebe88a22 100644
--- a/misc/android/go_android_exec.go
+++ b/misc/android/go_android_exec.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 // This program can be used as go_android_GOARCH_exec by the Go tool.
diff --git a/misc/cgo/gmp/fib.go b/misc/cgo/gmp/fib.go
index f1091b1c54f..f453fcf1843 100644
--- a/misc/cgo/gmp/fib.go
+++ b/misc/cgo/gmp/fib.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 // Compute Fibonacci numbers with two goroutines
diff --git a/misc/cgo/gmp/pi.go b/misc/cgo/gmp/pi.go
index d5851e8e6bd..5ea034900a9 100644
--- a/misc/cgo/gmp/pi.go
+++ b/misc/cgo/gmp/pi.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 package main
diff --git a/misc/cgo/test/cgo_thread_lock.go b/misc/cgo/test/cgo_thread_lock.go
index b1050685182..3b9ac845493 100644
--- a/misc/cgo/test/cgo_thread_lock.go
+++ b/misc/cgo/test/cgo_thread_lock.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build linux && freebsd && openbsd
 // +build linux,freebsd,openbsd
 
 package cgotest
diff --git a/misc/cgo/test/cgo_unix_test.go b/misc/cgo/test/cgo_unix_test.go
index e3d59166498..a324503a22f 100644
--- a/misc/cgo/test/cgo_unix_test.go
+++ b/misc/cgo/test/cgo_unix_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !windows
 // +build !windows
 
 package cgotest
diff --git a/misc/cgo/test/issue1435.go b/misc/cgo/test/issue1435.go
index 92c6b998465..91db155c90b 100644
--- a/misc/cgo/test/issue1435.go
+++ b/misc/cgo/test/issue1435.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build linux && cgo
 // +build linux,cgo
 
 package cgotest
diff --git a/misc/cgo/test/issue18146.go b/misc/cgo/test/issue18146.go
index f92d6c7f939..e50f9ae5301 100644
--- a/misc/cgo/test/issue18146.go
+++ b/misc/cgo/test/issue18146.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !windows
 // +build !windows
 
 // Issue 18146: pthread_create failure during syscall.Exec.
diff --git a/misc/cgo/test/issue21897.go b/misc/cgo/test/issue21897.go
index d13246bd84a..8f39252e688 100644
--- a/misc/cgo/test/issue21897.go
+++ b/misc/cgo/test/issue21897.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build darwin && cgo && !internal
 // +build darwin,cgo,!internal
 
 package cgotest
diff --git a/misc/cgo/test/issue21897b.go b/misc/cgo/test/issue21897b.go
index 08b5f4d808e..50aece35289 100644
--- a/misc/cgo/test/issue21897b.go
+++ b/misc/cgo/test/issue21897b.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !darwin || !cgo || internal
 // +build !darwin !cgo internal
 
 package cgotest
diff --git a/misc/cgo/test/issue4029.go b/misc/cgo/test/issue4029.go
index b2d131833a9..90ca08cbfb7 100644
--- a/misc/cgo/test/issue4029.go
+++ b/misc/cgo/test/issue4029.go
@@ -2,7 +2,9 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !windows,!static
+//go:build !windows && !static && (!darwin || (!internal_pie && !arm64))
+// +build !windows
+// +build !static
 // +build !darwin !internal_pie,!arm64
 
 // Excluded in darwin internal linking PIE mode, as dynamic export is not
diff --git a/misc/cgo/test/issue4029w.go b/misc/cgo/test/issue4029w.go
index b969bdd0fe8..c2f59485e49 100644
--- a/misc/cgo/test/issue4029w.go
+++ b/misc/cgo/test/issue4029w.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build windows || static || (darwin && internal_pie) || (darwin && arm64)
 // +build windows static darwin,internal_pie darwin,arm64
 
 package cgotest
diff --git a/misc/cgo/test/issue6997_linux.go b/misc/cgo/test/issue6997_linux.go
index f19afb8b7ad..4acc8c1a070 100644
--- a/misc/cgo/test/issue6997_linux.go
+++ b/misc/cgo/test/issue6997_linux.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !android
 // +build !android
 
 // Test that pthread_cancel works as expected
diff --git a/misc/cgo/test/issue8517.go b/misc/cgo/test/issue8517.go
index 4e431df921d..7316ab0335d 100644
--- a/misc/cgo/test/issue8517.go
+++ b/misc/cgo/test/issue8517.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !windows
 // +build !windows
 
 package cgotest
diff --git a/misc/cgo/test/issue8694.go b/misc/cgo/test/issue8694.go
index 89be7ea0907..19071ce1595 100644
--- a/misc/cgo/test/issue8694.go
+++ b/misc/cgo/test/issue8694.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !android
 // +build !android
 
 package cgotest
diff --git a/misc/cgo/test/sigaltstack.go b/misc/cgo/test/sigaltstack.go
index 034cc4b3719..6b371897a73 100644
--- a/misc/cgo/test/sigaltstack.go
+++ b/misc/cgo/test/sigaltstack.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !windows && !android
 // +build !windows,!android
 
 // Test that the Go runtime still works if C code changes the signal stack.
diff --git a/misc/cgo/test/sigprocmask.go b/misc/cgo/test/sigprocmask.go
index e2b939f05e2..983734cc7b6 100644
--- a/misc/cgo/test/sigprocmask.go
+++ b/misc/cgo/test/sigprocmask.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !windows
 // +build !windows
 
 package cgotest
diff --git a/misc/cgo/test/test_unix.go b/misc/cgo/test/test_unix.go
index 4a234469dbc..831b9ca625a 100644
--- a/misc/cgo/test/test_unix.go
+++ b/misc/cgo/test/test_unix.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !windows
 // +build !windows
 
 package cgotest
diff --git a/misc/cgo/testso/noso_test.go b/misc/cgo/testso/noso_test.go
index c88aebfb02a..1014534d62c 100644
--- a/misc/cgo/testso/noso_test.go
+++ b/misc/cgo/testso/noso_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !cgo
 // +build !cgo
 
 package so_test
diff --git a/misc/cgo/testso/so_test.go b/misc/cgo/testso/so_test.go
index 2023c51f113..6d14e32dc6c 100644
--- a/misc/cgo/testso/so_test.go
+++ b/misc/cgo/testso/so_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build cgo
 // +build cgo
 
 package so_test
diff --git a/misc/cgo/testsovar/noso_test.go b/misc/cgo/testsovar/noso_test.go
index c88aebfb02a..1014534d62c 100644
--- a/misc/cgo/testsovar/noso_test.go
+++ b/misc/cgo/testsovar/noso_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !cgo
 // +build !cgo
 
 package so_test
diff --git a/misc/cgo/testsovar/so_test.go b/misc/cgo/testsovar/so_test.go
index 2023c51f113..6d14e32dc6c 100644
--- a/misc/cgo/testsovar/so_test.go
+++ b/misc/cgo/testsovar/so_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build cgo
 // +build cgo
 
 package so_test
diff --git a/misc/cgo/testtls/tls_test.go b/misc/cgo/testtls/tls_test.go
index 3076c2d5943..a3b67c00441 100644
--- a/misc/cgo/testtls/tls_test.go
+++ b/misc/cgo/testtls/tls_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !windows
 // +build !windows
 
 package cgotlstest
diff --git a/misc/ios/detect.go b/misc/ios/detect.go
index cde57238923..1cb8ae5ff71 100644
--- a/misc/ios/detect.go
+++ b/misc/ios/detect.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 // detect attempts to autodetect the correct
diff --git a/misc/reboot/experiment_toolid_test.go b/misc/reboot/experiment_toolid_test.go
index 4f40284d80f..87a828e32f7 100644
--- a/misc/reboot/experiment_toolid_test.go
+++ b/misc/reboot/experiment_toolid_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build explicit
 // +build explicit
 
 // Package experiment_toolid_test verifies that GOEXPERIMENT settings built
diff --git a/src/cmd/compile/internal/base/bootstrap_false.go b/src/cmd/compile/internal/base/bootstrap_false.go
index de86644527d..c77fcd73081 100644
--- a/src/cmd/compile/internal/base/bootstrap_false.go
+++ b/src/cmd/compile/internal/base/bootstrap_false.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !compiler_bootstrap
 // +build !compiler_bootstrap
 
 package base
diff --git a/src/cmd/compile/internal/base/bootstrap_true.go b/src/cmd/compile/internal/base/bootstrap_true.go
index 81a17e1f6e5..1eb58b2f9dc 100644
--- a/src/cmd/compile/internal/base/bootstrap_true.go
+++ b/src/cmd/compile/internal/base/bootstrap_true.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build compiler_bootstrap
 // +build compiler_bootstrap
 
 package base
diff --git a/src/cmd/compile/internal/noder/frames_go1.go b/src/cmd/compile/internal/noder/frames_go1.go
index 2958efd6222..d00e0f51f9f 100644
--- a/src/cmd/compile/internal/noder/frames_go1.go
+++ b/src/cmd/compile/internal/noder/frames_go1.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build !go1.7
 // +build !go1.7
 
 // TODO(mdempsky): Remove after #44505 is resolved
diff --git a/src/cmd/compile/internal/noder/frames_go17.go b/src/cmd/compile/internal/noder/frames_go17.go
index 273217e39a1..48d77625b41 100644
--- a/src/cmd/compile/internal/noder/frames_go17.go
+++ b/src/cmd/compile/internal/noder/frames_go17.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build go1.7
 // +build go1.7
 
 package noder
diff --git a/src/cmd/compile/internal/ssa/gen/386Ops.go b/src/cmd/compile/internal/ssa/gen/386Ops.go
index c4b49fbb230..91f33c83745 100644
--- a/src/cmd/compile/internal/ssa/gen/386Ops.go
+++ b/src/cmd/compile/internal/ssa/gen/386Ops.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 package main
diff --git a/src/cmd/compile/internal/ssa/gen/MIPS64Ops.go b/src/cmd/compile/internal/ssa/gen/MIPS64Ops.go
index 77f251c0d3f..a18cd4289d4 100644
--- a/src/cmd/compile/internal/ssa/gen/MIPS64Ops.go
+++ b/src/cmd/compile/internal/ssa/gen/MIPS64Ops.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 package main
diff --git a/src/cmd/compile/internal/ssa/gen/MIPSOps.go b/src/cmd/compile/internal/ssa/gen/MIPSOps.go
index b92e8cb9f1e..8177c7e2d17 100644
--- a/src/cmd/compile/internal/ssa/gen/MIPSOps.go
+++ b/src/cmd/compile/internal/ssa/gen/MIPSOps.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 package main
diff --git a/src/cmd/compile/internal/ssa/gen/PPC64Ops.go b/src/cmd/compile/internal/ssa/gen/PPC64Ops.go
index f7198b90c32..d7d8a33a0a1 100644
--- a/src/cmd/compile/internal/ssa/gen/PPC64Ops.go
+++ b/src/cmd/compile/internal/ssa/gen/PPC64Ops.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 package main
diff --git a/src/cmd/compile/internal/ssa/gen/RISCV64Ops.go b/src/cmd/compile/internal/ssa/gen/RISCV64Ops.go
index 0ac9c5f62ad..0774d4c654f 100644
--- a/src/cmd/compile/internal/ssa/gen/RISCV64Ops.go
+++ b/src/cmd/compile/internal/ssa/gen/RISCV64Ops.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 package main
diff --git a/src/cmd/compile/internal/ssa/gen/S390XOps.go b/src/cmd/compile/internal/ssa/gen/S390XOps.go
index 5b33ba710e9..00fce8e0e58 100644
--- a/src/cmd/compile/internal/ssa/gen/S390XOps.go
+++ b/src/cmd/compile/internal/ssa/gen/S390XOps.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 package main
diff --git a/src/cmd/compile/internal/ssa/gen/WasmOps.go b/src/cmd/compile/internal/ssa/gen/WasmOps.go
index c92878ca73b..7f7ae5e8370 100644
--- a/src/cmd/compile/internal/ssa/gen/WasmOps.go
+++ b/src/cmd/compile/internal/ssa/gen/WasmOps.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 package main
diff --git a/src/cmd/compile/internal/ssa/gen/dec64Ops.go b/src/cmd/compile/internal/ssa/gen/dec64Ops.go
index 8c5883bc569..78fcea885aa 100644
--- a/src/cmd/compile/internal/ssa/gen/dec64Ops.go
+++ b/src/cmd/compile/internal/ssa/gen/dec64Ops.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 package main
diff --git a/src/cmd/compile/internal/ssa/gen/decOps.go b/src/cmd/compile/internal/ssa/gen/decOps.go
index b826481c9fb..d5cd79378c7 100644
--- a/src/cmd/compile/internal/ssa/gen/decOps.go
+++ b/src/cmd/compile/internal/ssa/gen/decOps.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build ignore
 // +build ignore
 
 package main
diff --git a/src/internal/syscall/windows/exec_windows_test.go b/src/internal/syscall/windows/exec_windows_test.go
index 283d7cea94b..0db626636e9 100644
--- a/src/internal/syscall/windows/exec_windows_test.go
+++ b/src/internal/syscall/windows/exec_windows_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // 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 599f07601bd..39f745db7a3 100644
--- a/src/internal/syscall/windows/mksyscall.go
+++ b/src/internal/syscall/windows/mksyscall.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // 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 8badf6fdcf1..d02d93f2875 100644
--- a/src/internal/syscall/windows/registry/export_test.go
+++ b/src/internal/syscall/windows/registry/export_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // 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 612c48f0840..ebe73a2e024 100644
--- a/src/internal/syscall/windows/registry/key.go
+++ b/src/internal/syscall/windows/registry/key.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // 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 320abf7fc69..0a007df7ccd 100644
--- a/src/internal/syscall/windows/registry/mksyscall.go
+++ b/src/internal/syscall/windows/registry/mksyscall.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // 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 57971629006..69b84e1c4c5 100644
--- a/src/internal/syscall/windows/registry/registry_test.go
+++ b/src/internal/syscall/windows/registry/registry_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // 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 a6525dac5d9..bb612793613 100644
--- a/src/internal/syscall/windows/registry/syscall.go
+++ b/src/internal/syscall/windows/registry/syscall.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // 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 dc3930a6bc2..e1fc99c40d4 100644
--- a/src/internal/syscall/windows/registry/value.go
+++ b/src/internal/syscall/windows/registry/value.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // 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 c587c19c77d..61b998e4cfc 100644
--- a/src/internal/syscall/windows/sysdll/sysdll.go
+++ b/src/internal/syscall/windows/sysdll/sysdll.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // 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
diff --git a/src/runtime/msan/msan.go b/src/runtime/msan/msan.go
index c81577dddac..9908a8ec221 100644
--- a/src/runtime/msan/msan.go
+++ b/src/runtime/msan/msan.go
@@ -2,7 +2,9 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build msan,linux
+//go:build msan && linux && (amd64 || arm64)
+// +build msan
+// +build linux
 // +build amd64 arm64
 
 package msan
diff --git a/src/syscall/js/export_test.go b/src/syscall/js/export_test.go
index 1b5ed3ce849..4bd9c5d595e 100644
--- a/src/syscall/js/export_test.go
+++ b/src/syscall/js/export_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // 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 da4cf68774d..ab23e5fbfc0 100644
--- a/src/syscall/js/func.go
+++ b/src/syscall/js/func.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // 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 a48bbd4dd79..d805d691664 100644
--- a/src/syscall/js/js.go
+++ b/src/syscall/js/js.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // 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.
diff --git a/src/syscall/js/js_test.go b/src/syscall/js/js_test.go
index 5fc9107d402..8088a897f60 100644
--- a/src/syscall/js/js_test.go
+++ b/src/syscall/js/js_test.go
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+//go:build js && wasm
 // +build js,wasm
 
 // To run these tests:
-- 
GitLab