]> Cypherpunks repositories - gostls13.git/commitdiff
all: gofmt more (but vendor, testdata, and top-level test directories)
authorDmitri Shuralyov <dmitshur@golang.org>
Tue, 10 Aug 2021 00:29:14 +0000 (20:29 -0400)
committerDmitri Shuralyov <dmitshur@golang.org>
Fri, 13 Aug 2021 20:45:17 +0000 (20:45 +0000)
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>

51 files changed:
misc/android/go_android_exec.go
misc/cgo/gmp/fib.go
misc/cgo/gmp/pi.go
misc/cgo/test/cgo_thread_lock.go
misc/cgo/test/cgo_unix_test.go
misc/cgo/test/issue1435.go
misc/cgo/test/issue18146.go
misc/cgo/test/issue21897.go
misc/cgo/test/issue21897b.go
misc/cgo/test/issue4029.go
misc/cgo/test/issue4029w.go
misc/cgo/test/issue6997_linux.go
misc/cgo/test/issue8517.go
misc/cgo/test/issue8694.go
misc/cgo/test/sigaltstack.go
misc/cgo/test/sigprocmask.go
misc/cgo/test/test_unix.go
misc/cgo/testso/noso_test.go
misc/cgo/testso/so_test.go
misc/cgo/testsovar/noso_test.go
misc/cgo/testsovar/so_test.go
misc/cgo/testtls/tls_test.go
misc/ios/detect.go
misc/reboot/experiment_toolid_test.go
src/cmd/compile/internal/base/bootstrap_false.go
src/cmd/compile/internal/base/bootstrap_true.go
src/cmd/compile/internal/noder/frames_go1.go
src/cmd/compile/internal/noder/frames_go17.go
src/cmd/compile/internal/ssa/gen/386Ops.go
src/cmd/compile/internal/ssa/gen/MIPS64Ops.go
src/cmd/compile/internal/ssa/gen/MIPSOps.go
src/cmd/compile/internal/ssa/gen/PPC64Ops.go
src/cmd/compile/internal/ssa/gen/RISCV64Ops.go
src/cmd/compile/internal/ssa/gen/S390XOps.go
src/cmd/compile/internal/ssa/gen/WasmOps.go
src/cmd/compile/internal/ssa/gen/dec64Ops.go
src/cmd/compile/internal/ssa/gen/decOps.go
src/internal/syscall/windows/exec_windows_test.go
src/internal/syscall/windows/mksyscall.go
src/internal/syscall/windows/registry/export_test.go
src/internal/syscall/windows/registry/key.go
src/internal/syscall/windows/registry/mksyscall.go
src/internal/syscall/windows/registry/registry_test.go
src/internal/syscall/windows/registry/syscall.go
src/internal/syscall/windows/registry/value.go
src/internal/syscall/windows/sysdll/sysdll.go
src/runtime/msan/msan.go
src/syscall/js/export_test.go
src/syscall/js/func.go
src/syscall/js/js.go
src/syscall/js/js_test.go

index 3af2bee5839b937aff5d724317e5b68df2259b06..168ebe88a2241340c8ecae41d5c3f85401bb7101 100644 (file)
@@ -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.
index f1091b1c54f45e62187aa6a3776507a0af8e851c..f453fcf1843b7c13123398a212c0d8cc64935817 100644 (file)
@@ -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
index d5851e8e6bd389a0049d0369f960f1fc4014e090..5ea034900a9b172a92fc6b716135f6450c4f5767 100644 (file)
@@ -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
index b1050685182287dd563a6d302ea819e1e6fbe138..3b9ac845493cd5cfd4d9a665e56e94cab2139956 100644 (file)
@@ -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
index e3d591664983befc0ef8b6bfe3f251f352f491d5..a324503a22faf06ac261c079cdb70e30c851c446 100644 (file)
@@ -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
index 92c6b998465caf39aeb7aebe1d39f266542de0f1..91db155c90b9836eb38042725612b9737512c28f 100644 (file)
@@ -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
index f92d6c7f939d22078a428f4ebfc8a80541cd0fdc..e50f9ae53016fce2f88e1b0118145635f41c19d5 100644 (file)
@@ -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.
index d13246bd84afdea8995c2e1ab2b5a2c69c2cc4ca..8f39252e688580af7bcd5525426cdd43dc7725a3 100644 (file)
@@ -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
index 08b5f4d808e240853d6b666ffd41ba2b5192d75f..50aece3528947ba2f8bd8ba2858628ffda1bf3fa 100644 (file)
@@ -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
index b2d131833a9377ac3643893b5aaa92cff4a179db..90ca08cbfb7da8b17d4b128aaf471a8dd546772f 100644 (file)
@@ -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
index b969bdd0fe8702a74ddfdf8bd72dfde97abe46ca..c2f59485e490d6aec158fddda918bfddf618253e 100644 (file)
@@ -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
index f19afb8b7ad81610520a3f8f5f69a3b5d8d0a746..4acc8c1a07062710cb33075dc5730d5d67e695bf 100644 (file)
@@ -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
index 4e431df921d1e33d4ca79faf9ea26e302a4aa6d9..7316ab0335d5cb587a50c90fa83ede25db8d649b 100644 (file)
@@ -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
index 89be7ea090763a909e810bbcff1ebf4a67da6986..19071ce1595ec74a4f588ac9e274960dc0693337 100644 (file)
@@ -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
index 034cc4b3719150c379d97c0f1efa9bc7ce4747c9..6b371897a73471812c674d44c13d07fcc738c8ed 100644 (file)
@@ -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.
index e2b939f05e2b4b61166f180ccd4548549765e67a..983734cc7b620c16e9a55d4449a8b829e5667d27 100644 (file)
@@ -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
index 4a234469dbc6e0d826392b85447893d734fdaa5d..831b9ca625a1fbb354c30fa5da3c7358b7cc45ba 100644 (file)
@@ -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
index c88aebfb02a91e13bf366973494413a9bab7d47c..1014534d62cf06962c4f17b96ebc3cfe896ded29 100644 (file)
@@ -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
index 2023c51f113785d14482ee7a7b3556825784e7c3..6d14e32dc6caa474d9ca85082407c50db8b5e56c 100644 (file)
@@ -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
index c88aebfb02a91e13bf366973494413a9bab7d47c..1014534d62cf06962c4f17b96ebc3cfe896ded29 100644 (file)
@@ -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
index 2023c51f113785d14482ee7a7b3556825784e7c3..6d14e32dc6caa474d9ca85082407c50db8b5e56c 100644 (file)
@@ -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
index 3076c2d5943b5cbc1482f504e7bbbe016ac71642..a3b67c004413aafcf305109fb893dd5ed0de09c8 100644 (file)
@@ -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
index cde57238923be6b959a3ac6c9341903416cbd17e..1cb8ae5ff711cc1548a825ba0f5706a6fedd26c0 100644 (file)
@@ -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
index 4f40284d80f107dd0014d1bfc1171d2a78ac05ef..87a828e32f73a40a1a0a64a31dd35bfc906139fd 100644 (file)
@@ -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
index de86644527d60ac482a746b33bc1cb872d5614e9..c77fcd730812d824c061d329ca0ed353d82a8b16 100644 (file)
@@ -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
index 81a17e1f6e5e56fc8f90280f0e7a7e934c608686..1eb58b2f9dc1ce86ca9fb095715e685e667cbb3e 100644 (file)
@@ -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
index 2958efd6222133b03ece396173e9f2e76e492383..d00e0f51f9f8f8d4fda8dc9fe3a26d6b8fb13332 100644 (file)
@@ -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
index 273217e39a135233dc4b973556cf5bfe7ca720ed..48d77625b41d11105e73f218164c3c3395832574 100644 (file)
@@ -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
index c4b49fbb23067d4e52e5940a25e6351b7adc4060..91f33c837457a3c944029de97383e8ebee9698af 100644 (file)
@@ -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
index 77f251c0d3f920ed3c1e43fefe781e5257b3748e..a18cd4289d4fc6b735311158e994ec1b4b8c1155 100644 (file)
@@ -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
index b92e8cb9f1ee64b38db0a24a78cc2058ddb7b0da..8177c7e2d17cfff541418718755150f7947cf54c 100644 (file)
@@ -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
index f7198b90c32e48ce940e6b52530aee7dea47c4fb..d7d8a33a0a10a52f8bd19ddb5ab2f5bbdc14e1cc 100644 (file)
@@ -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
index 0ac9c5f62ad176700958b5b648992cd3a3410e3e..0774d4c654f95728d024eee48fef23444567a82b 100644 (file)
@@ -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
index 5b33ba710e9818799df21ca130049381ced03c5b..00fce8e0e58b9a12728418aff98de10c0cbb28d0 100644 (file)
@@ -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
index c92878ca73b844a1a906829ba70b903e48391f90..7f7ae5e83701f17278102596ac3819ed0fcd4455 100644 (file)
@@ -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
index 8c5883bc5691348147d6845b20af96e961007100..78fcea885aa8b250304d0064e32ad0b03f52bc8e 100644 (file)
@@ -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
index b826481c9fbb2fdcb90b41742d66561f88a64014..d5cd79378c76a3041e007bc197c171f7272a4bda 100644 (file)
@@ -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
index 283d7cea94bfa0fdd622a301eacb56e2de232316..0db626636e95d1308cd6defb0937cb4a60b1da05 100644 (file)
@@ -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
index 599f07601bd4d5af2dedd8530b306776c7af850e..39f745db7a3d40bb38e386ae30d1b201ae9f06e3 100644 (file)
@@ -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
index 8badf6fdcf1f9a2612546c741e7119aea58abe24..d02d93f287522f62ae766b7f7a11fbcdb34bf2bd 100644 (file)
@@ -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
index 612c48f084060fa7c98339e91c076df070123532..ebe73a2e02468336a514ce1f5d95a89b6ae456ba 100644 (file)
@@ -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.
index 320abf7fc69ecaad80a1487c3ac76f5da018458f..0a007df7ccd08322d0650c1e0612a41b6e3d7b38 100644 (file)
@@ -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
index 57971629006a7a842ba748eeca38cf84c58078af..69b84e1c4c5f995f7804ac086f71c27708efb3ac 100644 (file)
@@ -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
index a6525dac5d91aca8337b323f7098dbee230ec164..bb612793613f571a1250a417a2773c1f782fff73 100644 (file)
@@ -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
index dc3930a6bc2edaa753b23a14f49ff2ecc1af6f13..e1fc99c40d4cdd8cd57bf15ef667939720a277b2 100644 (file)
@@ -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
index c587c19c77d45a31af9d77e18a30e35e627e1a81..61b998e4cfc3d164b8f224d7264ee68686396efb 100644 (file)
@@ -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
index c81577dddac08ca2992ccafb349df182a86561d7..9908a8ec22170fdf7782407e25247b909a25c56c 100644 (file)
@@ -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
index 1b5ed3ce8491c2838e5b430ad4a57bfc5fc48ce7..4bd9c5d595eb72a8a186de52d2beaf80e9aa7b9d 100644 (file)
@@ -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
index da4cf68774ddcd6ebd25aaaf1c93f548595883cb..ab23e5fbfc0cce35a8821c6de43ef36bbaf90157 100644 (file)
@@ -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
index a48bbd4dd794b707bbb50a49fee6691b8eed7340..d805d6916644d7d0c0dde33d1706bf87e72d064a 100644 (file)
@@ -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.
index 5fc9107d40250ce9da212e5db934a7c1c49da446..8088a897f60716ffb2f439f177fc7fa4372b99ce 100644 (file)
@@ -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: