aboutsummaryrefslogtreecommitdiff
path: root/src/os
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2021-02-19 18:35:10 -0500
committerRuss Cox <rsc@golang.org>2021-02-20 03:54:50 +0000
commitd4b26382342c98a95b85140b2863bc30c48edd68 (patch)
tree6ef0d77cc69a5a99a90fb528d083f6aca7448667 /src/os
parent0625460f79eed41039939f957baceaff5e269672 (diff)
downloadgo-d4b26382342c98a95b85140b2863bc30c48edd68.tar.gz
go-d4b26382342c98a95b85140b2863bc30c48edd68.zip
all: go fmt std cmd (but revert vendor)
Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/os')
-rw-r--r--src/os/dir_unix.go1
-rw-r--r--src/os/endian_big.go1
-rw-r--r--src/os/endian_little.go1
-rw-r--r--src/os/env_unix_test.go1
-rw-r--r--src/os/error_errno.go1
-rw-r--r--src/os/error_posix.go1
-rw-r--r--src/os/error_unix_test.go1
-rw-r--r--src/os/error_windows_test.go1
-rw-r--r--src/os/exec/exec_linux_test.go1
-rw-r--r--src/os/exec/exec_posix_test.go1
-rw-r--r--src/os/exec/exec_unix.go1
-rw-r--r--src/os/exec/lp_js.go1
-rw-r--r--src/os/exec/lp_unix.go1
-rw-r--r--src/os/exec/lp_unix_test.go1
-rw-r--r--src/os/exec/read3.go1
-rw-r--r--src/os/exec_posix.go1
-rw-r--r--src/os/exec_unix.go1
-rw-r--r--src/os/exec_unix_test.go1
-rw-r--r--src/os/executable_path.go1
-rw-r--r--src/os/executable_plan9.go1
-rw-r--r--src/os/executable_procfs.go1
-rw-r--r--src/os/executable_sysctl.go1
-rw-r--r--src/os/export_unix_test.go1
-rw-r--r--src/os/fifo_test.go1
-rw-r--r--src/os/file_posix.go1
-rw-r--r--src/os/file_unix.go1
-rw-r--r--src/os/os_unix_test.go1
-rw-r--r--src/os/path_unix.go1
-rw-r--r--src/os/pipe2_bsd.go1
-rw-r--r--src/os/pipe2_illumos.go1
-rw-r--r--src/os/pipe_bsd.go1
-rw-r--r--src/os/pipe_test.go1
-rw-r--r--src/os/rawconn.go1
-rw-r--r--src/os/rawconn_test.go1
-rw-r--r--src/os/readfrom_stub.go1
-rw-r--r--src/os/removeall_at.go1
-rw-r--r--src/os/removeall_noat.go1
-rw-r--r--src/os/signal/example_unix_test.go1
-rw-r--r--src/os/signal/internal/pty/pty.go1
-rw-r--r--src/os/signal/signal_cgo_test.go1
-rw-r--r--src/os/signal/signal_linux_test.go1
-rw-r--r--src/os/signal/signal_test.go1
-rw-r--r--src/os/signal/signal_unix.go1
-rw-r--r--src/os/stat_js.go1
-rw-r--r--src/os/stat_unix.go1
-rw-r--r--src/os/sticky_bsd.go1
-rw-r--r--src/os/sticky_notbsd.go1
-rw-r--r--src/os/sys_bsd.go1
-rw-r--r--src/os/sys_js.go1
-rw-r--r--src/os/sys_unix.go1
-rw-r--r--src/os/timeout_test.go5
-rw-r--r--src/os/types_unix.go4
-rw-r--r--src/os/user/cgo_lookup_unix.go4
-rw-r--r--src/os/user/cgo_unix_test.go4
-rw-r--r--src/os/user/getgrouplist_darwin.go1
-rw-r--r--src/os/user/getgrouplist_unix.go4
-rw-r--r--src/os/user/listgroups_aix.go1
-rw-r--r--src/os/user/listgroups_solaris.go1
-rw-r--r--src/os/user/listgroups_unix.go4
-rw-r--r--src/os/user/lookup_android.go1
-rw-r--r--src/os/user/lookup_stubs.go1
-rw-r--r--src/os/user/lookup_unix.go1
-rw-r--r--src/os/user/lookup_unix_test.go1
-rw-r--r--src/os/wait_unimp.go1
-rw-r--r--src/os/wait_wait6.go1
-rw-r--r--src/os/wait_waitid.go1
66 files changed, 76 insertions, 9 deletions
diff --git a/src/os/dir_unix.go b/src/os/dir_unix.go
index 0e1eab1c96..ef5c00aee0 100644
--- a/src/os/dir_unix.go
+++ b/src/os/dir_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 aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os
diff --git a/src/os/endian_big.go b/src/os/endian_big.go
index c98f124782..0529dccd6f 100644
--- a/src/os/endian_big.go
+++ b/src/os/endian_big.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 ppc64 || s390x || mips || mips64
// +build ppc64 s390x mips mips64
package os
diff --git a/src/os/endian_little.go b/src/os/endian_little.go
index 3efc5e0d8d..6be6020f53 100644
--- a/src/os/endian_little.go
+++ b/src/os/endian_little.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 386 || amd64 || arm || arm64 || ppc64le || mips64le || mipsle || riscv64 || wasm
// +build 386 amd64 arm arm64 ppc64le mips64le mipsle riscv64 wasm
package os
diff --git a/src/os/env_unix_test.go b/src/os/env_unix_test.go
index 89430b3e20..d45e1deb83 100644
--- a/src/os/env_unix_test.go
+++ b/src/os/env_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 aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package os_test
diff --git a/src/os/error_errno.go b/src/os/error_errno.go
index 31ae05a21e..580e915b73 100644
--- a/src/os/error_errno.go
+++ b/src/os/error_errno.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 !plan9
// +build !plan9
package os
diff --git a/src/os/error_posix.go b/src/os/error_posix.go
index 2aeca82304..268b3a923a 100644
--- a/src/os/error_posix.go
+++ b/src/os/error_posix.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 aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package os
diff --git a/src/os/error_unix_test.go b/src/os/error_unix_test.go
index 18bcf3f4e4..e45282a0fd 100644
--- a/src/os/error_unix_test.go
+++ b/src/os/error_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 aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os_test
diff --git a/src/os/error_windows_test.go b/src/os/error_windows_test.go
index b8191c5ebc..aa0c14b7d4 100644
--- a/src/os/error_windows_test.go
+++ b/src/os/error_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 os_test
diff --git a/src/os/exec/exec_linux_test.go b/src/os/exec/exec_linux_test.go
index 6f850204d6..3cfa30ee72 100644
--- a/src/os/exec/exec_linux_test.go
+++ b/src/os/exec/exec_linux_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 linux && cgo
// +build linux,cgo
// On systems that use glibc, calling malloc can create a new arena,
diff --git a/src/os/exec/exec_posix_test.go b/src/os/exec/exec_posix_test.go
index d4d67ac933..7b2c0c0c11 100644
--- a/src/os/exec/exec_posix_test.go
+++ b/src/os/exec/exec_posix_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 aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package exec_test
diff --git a/src/os/exec/exec_unix.go b/src/os/exec/exec_unix.go
index 51c52427c2..467c069e1c 100644
--- a/src/os/exec/exec_unix.go
+++ b/src/os/exec/exec_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 !plan9 && !windows
// +build !plan9,!windows
package exec
diff --git a/src/os/exec/lp_js.go b/src/os/exec/lp_js.go
index 6750fb99b0..4eac25fe6f 100644
--- a/src/os/exec/lp_js.go
+++ b/src/os/exec/lp_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 exec
diff --git a/src/os/exec/lp_unix.go b/src/os/exec/lp_unix.go
index 66c1df76fb..d1d246accf 100644
--- a/src/os/exec/lp_unix.go
+++ b/src/os/exec/lp_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 aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package exec
diff --git a/src/os/exec/lp_unix_test.go b/src/os/exec/lp_unix_test.go
index 296480fd04..75bcdb1fdd 100644
--- a/src/os/exec/lp_unix_test.go
+++ b/src/os/exec/lp_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 aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package exec
diff --git a/src/os/exec/read3.go b/src/os/exec/read3.go
index 8cc24da8cb..a8c71831d8 100644
--- a/src/os/exec/read3.go
+++ b/src/os/exec/read3.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 is a test program that verifies that it can read from
diff --git a/src/os/exec_posix.go b/src/os/exec_posix.go
index 8aa1e5e499..443d4e0218 100644
--- a/src/os/exec_posix.go
+++ b/src/os/exec_posix.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 aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package os
diff --git a/src/os/exec_unix.go b/src/os/exec_unix.go
index a1703a1259..d1bbeb7529 100644
--- a/src/os/exec_unix.go
+++ b/src/os/exec_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 aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os
diff --git a/src/os/exec_unix_test.go b/src/os/exec_unix_test.go
index d942cdb5e5..f14b3519fb 100644
--- a/src/os/exec_unix_test.go
+++ b/src/os/exec_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 aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package os_test
diff --git a/src/os/executable_path.go b/src/os/executable_path.go
index 7b8b83652c..625430ecfc 100644
--- a/src/os/executable_path.go
+++ b/src/os/executable_path.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 aix || openbsd
// +build aix openbsd
package os
diff --git a/src/os/executable_plan9.go b/src/os/executable_plan9.go
index a5947eaae1..105c03f0c1 100644
--- a/src/os/executable_plan9.go
+++ b/src/os/executable_plan9.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 plan9
// +build plan9
package os
diff --git a/src/os/executable_procfs.go b/src/os/executable_procfs.go
index 5ee41a4b2e..9c64a0d474 100644
--- a/src/os/executable_procfs.go
+++ b/src/os/executable_procfs.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 || netbsd || (js && wasm)
// +build linux netbsd js,wasm
package os
diff --git a/src/os/executable_sysctl.go b/src/os/executable_sysctl.go
index f9a4b18f60..039448b557 100644
--- a/src/os/executable_sysctl.go
+++ b/src/os/executable_sysctl.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 freebsd || dragonfly
// +build freebsd dragonfly
package os
diff --git a/src/os/export_unix_test.go b/src/os/export_unix_test.go
index 39866a68de..10f8312831 100644
--- a/src/os/export_unix_test.go
+++ b/src/os/export_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 aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os
diff --git a/src/os/fifo_test.go b/src/os/fifo_test.go
index 2439192a9d..c3607344ec 100644
--- a/src/os/fifo_test.go
+++ b/src/os/fifo_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 darwin || dragonfly || freebsd || linux || netbsd || openbsd
// +build darwin dragonfly freebsd linux netbsd openbsd
package os_test
diff --git a/src/os/file_posix.go b/src/os/file_posix.go
index 795c547856..211f2a1798 100644
--- a/src/os/file_posix.go
+++ b/src/os/file_posix.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 aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package os
diff --git a/src/os/file_unix.go b/src/os/file_unix.go
index f88450018e..e8b286c9ee 100644
--- a/src/os/file_unix.go
+++ b/src/os/file_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 aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os
diff --git a/src/os/os_unix_test.go b/src/os/os_unix_test.go
index 51693fd82a..9b4c0ab290 100644
--- a/src/os/os_unix_test.go
+++ b/src/os/os_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 aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os_test
diff --git a/src/os/path_unix.go b/src/os/path_unix.go
index c99a8240c5..db38359492 100644
--- a/src/os/path_unix.go
+++ b/src/os/path_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 aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os
diff --git a/src/os/pipe2_bsd.go b/src/os/pipe2_bsd.go
index 0ef894b476..0af8019525 100644
--- a/src/os/pipe2_bsd.go
+++ b/src/os/pipe2_bsd.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 freebsd || netbsd || openbsd
// +build freebsd netbsd openbsd
package os
diff --git a/src/os/pipe2_illumos.go b/src/os/pipe2_illumos.go
index 026ce62b9a..71b8cb8e25 100644
--- a/src/os/pipe2_illumos.go
+++ b/src/os/pipe2_illumos.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 illumos
// +build illumos
package os
diff --git a/src/os/pipe_bsd.go b/src/os/pipe_bsd.go
index 115d6baa19..57959a2ea4 100644
--- a/src/os/pipe_bsd.go
+++ b/src/os/pipe_bsd.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 aix || darwin || dragonfly || (js && wasm) || (solaris && !illumos)
// +build aix darwin dragonfly js,wasm solaris,!illumos
package os
diff --git a/src/os/pipe_test.go b/src/os/pipe_test.go
index b98e53845c..b663618502 100644
--- a/src/os/pipe_test.go
+++ b/src/os/pipe_test.go
@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.
// Test broken pipes on Unix systems.
+//go:build !plan9 && !js
// +build !plan9,!js
package os_test
diff --git a/src/os/rawconn.go b/src/os/rawconn.go
index 9e11cda8c9..ffc598b061 100644
--- a/src/os/rawconn.go
+++ b/src/os/rawconn.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 !plan9
// +build !plan9
package os
diff --git a/src/os/rawconn_test.go b/src/os/rawconn_test.go
index 2554f5b087..8aebaf87a6 100644
--- a/src/os/rawconn_test.go
+++ b/src/os/rawconn_test.go
@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.
// Test use of raw connections.
+//go:build !plan9 && !js
// +build !plan9,!js
package os_test
diff --git a/src/os/readfrom_stub.go b/src/os/readfrom_stub.go
index 65429d0cab..826760f3df 100644
--- a/src/os/readfrom_stub.go
+++ b/src/os/readfrom_stub.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
// +build !linux
package os
diff --git a/src/os/removeall_at.go b/src/os/removeall_at.go
index c1a1b726af..d04540bc63 100644
--- a/src/os/removeall_at.go
+++ b/src/os/removeall_at.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 aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package os
diff --git a/src/os/removeall_noat.go b/src/os/removeall_noat.go
index 7c888baaa9..853e0eddfc 100644
--- a/src/os/removeall_noat.go
+++ b/src/os/removeall_noat.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 !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris
package os
diff --git a/src/os/signal/example_unix_test.go b/src/os/signal/example_unix_test.go
index a0af37a5bb..3f7795b8cf 100644
--- a/src/os/signal/example_unix_test.go
+++ b/src/os/signal/example_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 aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package signal_test
diff --git a/src/os/signal/internal/pty/pty.go b/src/os/signal/internal/pty/pty.go
index f8813ce6be..8d2eac7103 100644
--- a/src/os/signal/internal/pty/pty.go
+++ b/src/os/signal/internal/pty/pty.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 (aix || darwin || dragonfly || freebsd || (linux && !android) || netbsd || openbsd) && cgo
// +build aix darwin dragonfly freebsd linux,!android netbsd openbsd
// +build cgo
diff --git a/src/os/signal/signal_cgo_test.go b/src/os/signal/signal_cgo_test.go
index a8a485613f..e1e4509e2a 100644
--- a/src/os/signal/signal_cgo_test.go
+++ b/src/os/signal/signal_cgo_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 (darwin || dragonfly || freebsd || (linux && !android) || netbsd || openbsd) && cgo
// +build darwin dragonfly freebsd linux,!android netbsd openbsd
// +build cgo
diff --git a/src/os/signal/signal_linux_test.go b/src/os/signal/signal_linux_test.go
index 2e553d0b0f..7abe1ec5a0 100644
--- a/src/os/signal/signal_linux_test.go
+++ b/src/os/signal/signal_linux_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 linux
// +build linux
package signal
diff --git a/src/os/signal/signal_test.go b/src/os/signal/signal_test.go
index bbc68af9fb..292d24c6f1 100644
--- a/src/os/signal/signal_test.go
+++ b/src/os/signal/signal_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 aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package signal
diff --git a/src/os/signal/signal_unix.go b/src/os/signal/signal_unix.go
index 90a1eca156..9e241c43ac 100644
--- a/src/os/signal/signal_unix.go
+++ b/src/os/signal/signal_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 aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package signal
diff --git a/src/os/stat_js.go b/src/os/stat_js.go
index 8d20ccddfc..3badf5ba57 100644
--- a/src/os/stat_js.go
+++ b/src/os/stat_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 os
diff --git a/src/os/stat_unix.go b/src/os/stat_unix.go
index 66c356fc62..8c17805f71 100644
--- a/src/os/stat_unix.go
+++ b/src/os/stat_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 aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os
diff --git a/src/os/sticky_bsd.go b/src/os/sticky_bsd.go
index c09b1ac202..ab23d8111d 100644
--- a/src/os/sticky_bsd.go
+++ b/src/os/sticky_bsd.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 aix || darwin || dragonfly || freebsd || (js && wasm) || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm netbsd openbsd solaris
package os
diff --git a/src/os/sticky_notbsd.go b/src/os/sticky_notbsd.go
index c15850692c..9979b43e8e 100644
--- a/src/os/sticky_notbsd.go
+++ b/src/os/sticky_notbsd.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 !aix && !darwin && !dragonfly && !freebsd && (!js || !wasm) && !netbsd && !openbsd && !solaris
// +build !aix
// +build !darwin
// +build !dragonfly
diff --git a/src/os/sys_bsd.go b/src/os/sys_bsd.go
index b1698f5d4c..1e245eb53a 100644
--- a/src/os/sys_bsd.go
+++ b/src/os/sys_bsd.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 || dragonfly || freebsd || (js && wasm) || netbsd || openbsd
// +build darwin dragonfly freebsd js,wasm netbsd openbsd
package os
diff --git a/src/os/sys_js.go b/src/os/sys_js.go
index e860654f81..4d6a64e8eb 100644
--- a/src/os/sys_js.go
+++ b/src/os/sys_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 os
diff --git a/src/os/sys_unix.go b/src/os/sys_unix.go
index 8491bad242..e316eaf06c 100644
--- a/src/os/sys_unix.go
+++ b/src/os/sys_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 aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package os
diff --git a/src/os/timeout_test.go b/src/os/timeout_test.go
index 0a39f46333..6d65e420f0 100644
--- a/src/os/timeout_test.go
+++ b/src/os/timeout_test.go
@@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !js
-// +build !plan9
-// +build !windows
+//go:build !js && !plan9 && !windows
+// +build !js,!plan9,!windows
package os_test
diff --git a/src/os/types_unix.go b/src/os/types_unix.go
index c0259ae0e8..e9b8b8ba3a 100644
--- a/src/os/types_unix.go
+++ b/src/os/types_unix.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !windows
-// +build !plan9
+//go:build !windows && !plan9
+// +build !windows,!plan9
package os
diff --git a/src/os/user/cgo_lookup_unix.go b/src/os/user/cgo_lookup_unix.go
index 3307f790ea..abc9e9ce6d 100644
--- a/src/os/user/cgo_lookup_unix.go
+++ b/src/os/user/cgo_lookup_unix.go
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (aix || darwin || dragonfly || freebsd || (!android && linux) || netbsd || openbsd || solaris) && cgo && !osusergo
// +build aix darwin dragonfly freebsd !android,linux netbsd openbsd solaris
-// +build cgo,!osusergo
+// +build cgo
+// +build !osusergo
package user
diff --git a/src/os/user/cgo_unix_test.go b/src/os/user/cgo_unix_test.go
index 1d341aa427..9ec32b3a78 100644
--- a/src/os/user/cgo_unix_test.go
+++ b/src/os/user/cgo_unix_test.go
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (darwin || dragonfly || freebsd || (!android && linux) || netbsd || openbsd || solaris) && cgo && !osusergo
// +build darwin dragonfly freebsd !android,linux netbsd openbsd solaris
-// +build cgo,!osusergo
+// +build cgo
+// +build !osusergo
package user
diff --git a/src/os/user/getgrouplist_darwin.go b/src/os/user/getgrouplist_darwin.go
index e8fe26c47f..23d12e3247 100644
--- a/src/os/user/getgrouplist_darwin.go
+++ b/src/os/user/getgrouplist_darwin.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 && !osusergo
// +build cgo,!osusergo
package user
diff --git a/src/os/user/getgrouplist_unix.go b/src/os/user/getgrouplist_unix.go
index 9685414fc0..8393c5a474 100644
--- a/src/os/user/getgrouplist_unix.go
+++ b/src/os/user/getgrouplist_unix.go
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (dragonfly || freebsd || (!android && linux) || netbsd || openbsd) && cgo && !osusergo
// +build dragonfly freebsd !android,linux netbsd openbsd
-// +build cgo,!osusergo
+// +build cgo
+// +build !osusergo
package user
diff --git a/src/os/user/listgroups_aix.go b/src/os/user/listgroups_aix.go
index 17de3e98d4..d2fdfdc6b1 100644
--- a/src/os/user/listgroups_aix.go
+++ b/src/os/user/listgroups_aix.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 && !osusergo
// +build cgo,!osusergo
package user
diff --git a/src/os/user/listgroups_solaris.go b/src/os/user/listgroups_solaris.go
index f3cbf6ce4a..d993d30570 100644
--- a/src/os/user/listgroups_solaris.go
+++ b/src/os/user/listgroups_solaris.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 && !osusergo
// +build cgo,!osusergo
// Even though this file requires no C, it is used to provide a
diff --git a/src/os/user/listgroups_unix.go b/src/os/user/listgroups_unix.go
index 70f7af7f97..c7b72062d5 100644
--- a/src/os/user/listgroups_unix.go
+++ b/src/os/user/listgroups_unix.go
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (dragonfly || darwin || freebsd || (!android && linux) || netbsd || openbsd) && cgo && !osusergo
// +build dragonfly darwin freebsd !android,linux netbsd openbsd
-// +build cgo,!osusergo
+// +build cgo
+// +build !osusergo
package user
diff --git a/src/os/user/lookup_android.go b/src/os/user/lookup_android.go
index 8ca30b8c27..151aab49c2 100644
--- a/src/os/user/lookup_android.go
+++ b/src/os/user/lookup_android.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 user
diff --git a/src/os/user/lookup_stubs.go b/src/os/user/lookup_stubs.go
index 178d814dda..c975a11964 100644
--- a/src/os/user/lookup_stubs.go
+++ b/src/os/user/lookup_stubs.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 && !windows && !plan9) || android || (osusergo && !windows && !plan9)
// +build !cgo,!windows,!plan9 android osusergo,!windows,!plan9
package user
diff --git a/src/os/user/lookup_unix.go b/src/os/user/lookup_unix.go
index 0890cd8f2b..ed8c2dee9d 100644
--- a/src/os/user/lookup_unix.go
+++ b/src/os/user/lookup_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 (aix || darwin || dragonfly || freebsd || (js && wasm) || (!android && linux) || netbsd || openbsd || solaris) && (!cgo || osusergo)
// +build aix darwin dragonfly freebsd js,wasm !android,linux netbsd openbsd solaris
// +build !cgo osusergo
diff --git a/src/os/user/lookup_unix_test.go b/src/os/user/lookup_unix_test.go
index 72d3b47534..c697802171 100644
--- a/src/os/user/lookup_unix_test.go
+++ b/src/os/user/lookup_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 (aix || darwin || dragonfly || freebsd || (!android && linux) || netbsd || openbsd || solaris) && !cgo
// +build aix darwin dragonfly freebsd !android,linux netbsd openbsd solaris
// +build !cgo
diff --git a/src/os/wait_unimp.go b/src/os/wait_unimp.go
index 0f4cdc4533..28dc2a5939 100644
--- a/src/os/wait_unimp.go
+++ b/src/os/wait_unimp.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 aix || darwin || dragonfly || (js && wasm) || netbsd || openbsd || solaris
// +build aix darwin dragonfly js,wasm netbsd openbsd solaris
package os
diff --git a/src/os/wait_wait6.go b/src/os/wait_wait6.go
index 5420b2db73..895f21069a 100644
--- a/src/os/wait_wait6.go
+++ b/src/os/wait_wait6.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 freebsd
// +build freebsd
package os
diff --git a/src/os/wait_waitid.go b/src/os/wait_waitid.go
index 9c56eb2d41..1f3cb1cfe2 100644
--- a/src/os/wait_waitid.go
+++ b/src/os/wait_waitid.go
@@ -5,6 +5,7 @@
// We used to used this code for Darwin, but according to issue #19314
// waitid returns if the process is stopped, even when using WEXITED.
+//go:build linux
// +build linux
package os