From 99a53858aa08ff7f0d85e0b3164e66ce1979b95f Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Tue, 9 Nov 2021 12:45:02 -0500 Subject: [PATCH] all: add missing //go:build comments These were apparently overlooked in CL 357329, CL 294490, CL 296889, and other various updates to this module. (I noticed them via gopls while investigating golang/go#49466.) Updates golang/go#41184 Change-Id: Id042bb6fe5282e6d528e9315acf2ad29d0df58ba Reviewed-on: https://go-review.googlesource.com/c/sys/+/362577 Trust: Bryan C. Mills Run-TryBot: Bryan C. Mills Reviewed-by: Ian Lance Taylor Reviewed-by: Tobias Klauser TryBot-Result: Go Bot --- plan9/mksyscall.go | 11 +++++++++-- plan9/pwd_go15_plan9.go | 1 + plan9/pwd_plan9.go | 1 + plan9/race.go | 1 + plan9/race0.go | 1 + plan9/str.go | 1 + plan9/syscall.go | 1 + plan9/syscall_test.go | 1 + plan9/zsyscall_plan9_386.go | 1 + plan9/zsyscall_plan9_amd64.go | 1 + plan9/zsyscall_plan9_arm.go | 1 + unix/linux/mkall.go | 1 + unix/mkmerge_test.go | 2 ++ windows/registry/export_test.go | 1 + windows/registry/mksyscall.go | 1 + windows/registry/registry_test.go | 1 + windows/registry/syscall.go | 1 + windows/registry/value.go | 1 + windows/svc/debug/log.go | 1 + windows/svc/debug/service.go | 1 + windows/svc/eventlog/install.go | 1 + windows/svc/eventlog/log.go | 1 + windows/svc/eventlog/log_test.go | 1 + windows/svc/example/beep.go | 1 + windows/svc/example/install.go | 1 + windows/svc/example/main.go | 1 + windows/svc/example/manage.go | 1 + windows/svc/example/service.go | 1 + windows/svc/mgr/config.go | 1 + windows/svc/mgr/mgr.go | 1 + windows/svc/mgr/mgr_test.go | 1 + windows/svc/mgr/recovery.go | 1 + windows/svc/mgr/service.go | 1 + 33 files changed, 42 insertions(+), 2 deletions(-) diff --git a/plan9/mksyscall.go b/plan9/mksyscall.go index c403de16..2d07e8bb 100644 --- a/plan9/mksyscall.go +++ b/plan9/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 ignore // +build ignore /* @@ -49,7 +50,12 @@ func cmdLine() string { return "go run mksyscall.go " + strings.Join(os.Args[1:], " ") } -// buildTags returns build tags +// goBuildTags returns build tags in the go:build format. +func goBuildTags() string { + return strings.ReplaceAll(*tags, ",", " && ") +} + +// plusBuildTags returns build tags in the +build format. func buildTags() string { return *tags } @@ -377,12 +383,13 @@ func main() { } file.Close() } - fmt.Printf(srcTemplate, cmdLine(), buildTags(), text) + fmt.Printf(srcTemplate, cmdLine(), goBuildTags(), plusBuildTags(), text) } const srcTemplate = `// %s // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build %s // +build %s package plan9 diff --git a/plan9/pwd_go15_plan9.go b/plan9/pwd_go15_plan9.go index 87ae9d2a..c9b69937 100644 --- a/plan9/pwd_go15_plan9.go +++ b/plan9/pwd_go15_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 go1.5 // +build go1.5 package plan9 diff --git a/plan9/pwd_plan9.go b/plan9/pwd_plan9.go index c07c798b..98bf56b7 100644 --- a/plan9/pwd_plan9.go +++ b/plan9/pwd_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 !go1.5 // +build !go1.5 package plan9 diff --git a/plan9/race.go b/plan9/race.go index 42edd93e..62377d2f 100644 --- a/plan9/race.go +++ b/plan9/race.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 && race // +build plan9,race package plan9 diff --git a/plan9/race0.go b/plan9/race0.go index c89cf8fc..f8da3087 100644 --- a/plan9/race0.go +++ b/plan9/race0.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 && !race // +build plan9,!race package plan9 diff --git a/plan9/str.go b/plan9/str.go index 4f7f9ad7..55fa8d02 100644 --- a/plan9/str.go +++ b/plan9/str.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 plan9 diff --git a/plan9/syscall.go b/plan9/syscall.go index e7363a2f..602473cb 100644 --- a/plan9/syscall.go +++ b/plan9/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 plan9 // +build plan9 // Package plan9 contains an interface to the low-level operating system diff --git a/plan9/syscall_test.go b/plan9/syscall_test.go index 8f829bad..50b4f685 100644 --- a/plan9/syscall_test.go +++ b/plan9/syscall_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 plan9 // +build plan9 package plan9_test diff --git a/plan9/zsyscall_plan9_386.go b/plan9/zsyscall_plan9_386.go index 6819bc20..3f40b9bd 100644 --- a/plan9/zsyscall_plan9_386.go +++ b/plan9/zsyscall_plan9_386.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -plan9 -tags plan9,386 syscall_plan9.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build plan9 && 386 // +build plan9,386 package plan9 diff --git a/plan9/zsyscall_plan9_amd64.go b/plan9/zsyscall_plan9_amd64.go index 418abbbf..0e6a96aa 100644 --- a/plan9/zsyscall_plan9_amd64.go +++ b/plan9/zsyscall_plan9_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -plan9 -tags plan9,amd64 syscall_plan9.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build plan9 && amd64 // +build plan9,amd64 package plan9 diff --git a/plan9/zsyscall_plan9_arm.go b/plan9/zsyscall_plan9_arm.go index 3e8a1a58..244c501b 100644 --- a/plan9/zsyscall_plan9_arm.go +++ b/plan9/zsyscall_plan9_arm.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -plan9 -tags plan9,arm syscall_plan9.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build plan9 && arm // +build plan9,arm package plan9 diff --git a/unix/linux/mkall.go b/unix/linux/mkall.go index 3e281206..70a58d3c 100644 --- a/unix/linux/mkall.go +++ b/unix/linux/mkall.go @@ -10,6 +10,7 @@ // the appropriate sources are ready, the program is run as: // go run linux/mkall.go +//go:build ignore // +build ignore package main diff --git a/unix/mkmerge_test.go b/unix/mkmerge_test.go index 04ee3934..a1463b97 100644 --- a/unix/mkmerge_test.go +++ b/unix/mkmerge_test.go @@ -105,6 +105,7 @@ func TestMerge(t *testing.T) { // build directives for arch{{.}} +//go:build goos && arch{{.}} // +build goos,arch{{.}} package main @@ -190,6 +191,7 @@ const ( // build directives for arch{{.}} +//go:build goos && arch{{.}} // +build goos,arch{{.}} package main diff --git a/windows/registry/export_test.go b/windows/registry/export_test.go index 8badf6fd..d02d93f2 100644 --- a/windows/registry/export_test.go +++ b/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/windows/registry/mksyscall.go b/windows/registry/mksyscall.go index 50c32a3f..ee74927d 100644 --- a/windows/registry/mksyscall.go +++ b/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/windows/registry/registry_test.go b/windows/registry/registry_test.go index c9341223..e2dd66fb 100644 --- a/windows/registry/registry_test.go +++ b/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/windows/registry/syscall.go b/windows/registry/syscall.go index e66643cb..41733512 100644 --- a/windows/registry/syscall.go +++ b/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/windows/registry/value.go b/windows/registry/value.go index f25e7e97..2789f6f1 100644 --- a/windows/registry/value.go +++ b/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/windows/svc/debug/log.go b/windows/svc/debug/log.go index e51ab42a..6ee64ca8 100644 --- a/windows/svc/debug/log.go +++ b/windows/svc/debug/log.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 debug diff --git a/windows/svc/debug/service.go b/windows/svc/debug/service.go index e621b87a..3b41899f 100644 --- a/windows/svc/debug/service.go +++ b/windows/svc/debug/service.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 debug provides facilities to execute svc.Handler on console. diff --git a/windows/svc/eventlog/install.go b/windows/svc/eventlog/install.go index c76a3760..43e324f4 100644 --- a/windows/svc/eventlog/install.go +++ b/windows/svc/eventlog/install.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 eventlog diff --git a/windows/svc/eventlog/log.go b/windows/svc/eventlog/log.go index 46e5153d..a1796fbb 100644 --- a/windows/svc/eventlog/log.go +++ b/windows/svc/eventlog/log.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 eventlog implements access to Windows event log. diff --git a/windows/svc/eventlog/log_test.go b/windows/svc/eventlog/log_test.go index 6fbbd4a8..a667b8fb 100644 --- a/windows/svc/eventlog/log_test.go +++ b/windows/svc/eventlog/log_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 eventlog_test diff --git a/windows/svc/example/beep.go b/windows/svc/example/beep.go index dcf23408..b454f593 100644 --- a/windows/svc/example/beep.go +++ b/windows/svc/example/beep.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 main diff --git a/windows/svc/example/install.go b/windows/svc/example/install.go index 39cb00d2..4e9ac883 100644 --- a/windows/svc/example/install.go +++ b/windows/svc/example/install.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 main diff --git a/windows/svc/example/main.go b/windows/svc/example/main.go index 9bf9bbdc..a47650fb 100644 --- a/windows/svc/example/main.go +++ b/windows/svc/example/main.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 // Example service program that beeps. diff --git a/windows/svc/example/manage.go b/windows/svc/example/manage.go index 782dbd96..8ba3952a 100644 --- a/windows/svc/example/manage.go +++ b/windows/svc/example/manage.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 main diff --git a/windows/svc/example/service.go b/windows/svc/example/service.go index 45e4c90f..c989abff 100644 --- a/windows/svc/example/service.go +++ b/windows/svc/example/service.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 main diff --git a/windows/svc/mgr/config.go b/windows/svc/mgr/config.go index da4df638..04554862 100644 --- a/windows/svc/mgr/config.go +++ b/windows/svc/mgr/config.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 mgr diff --git a/windows/svc/mgr/mgr.go b/windows/svc/mgr/mgr.go index 8e78daf3..de75f4a4 100644 --- a/windows/svc/mgr/mgr.go +++ b/windows/svc/mgr/mgr.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 mgr can be used to manage Windows service programs. diff --git a/windows/svc/mgr/mgr_test.go b/windows/svc/mgr/mgr_test.go index 7035db2a..330cca4a 100644 --- a/windows/svc/mgr/mgr_test.go +++ b/windows/svc/mgr/mgr_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 mgr_test diff --git a/windows/svc/mgr/recovery.go b/windows/svc/mgr/recovery.go index e465cbbd..2e042dd6 100644 --- a/windows/svc/mgr/recovery.go +++ b/windows/svc/mgr/recovery.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 mgr diff --git a/windows/svc/mgr/service.go b/windows/svc/mgr/service.go index 7d735ca2..0623fc0b 100644 --- a/windows/svc/mgr/service.go +++ b/windows/svc/mgr/service.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 mgr