Running 'go fix' on the cmd+std packages handled much of this change.
Also update code generators to use only the new go:build lines,
not the old +build ones.
For #41184.
For #60268.
Change-Id: If35532abe3012e7357b02c79d5992ff5ac37ca23
Cq-Include-Trybots: luci.golang.try:gotip-linux-386-longtest,gotip-linux-amd64-longtest,gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/536237
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
# regular 'go run .' usage to run the generator.
cat >main_test.go <<-EOF
- // +build ignore
+ //go:build ignore
package main
// to avoid depending on having a working compiler binary.
//go:build ignore
-// +build ignore
package coverage
// why Go moved on from Go 1.4 for bootstrap.
//go:build !go1.20
-// +build !go1.20
package building_Go_requires_Go_1_20_6_or_later
// license that can be found in the LICENSE file.
//go:build !windows
-// +build !windows
package main
// license that can be found in the LICENSE file.
//go:build gc
-// +build gc
package main
// license that can be found in the LICENSE file.
//go:build gccgo
-// +build gccgo
package main
// license that can be found in the LICENSE file.
//go:build gc
-// +build gc
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build gc && !arm
-// +build gc,!arm
#include "textflag.h"
// a MultiplePackageError on an otherwise valid package: the package could
// have different names for GOOS=windows and GOOS=mac for example. On the
// other hand if there's a NoGoError, the package might have source files
- // specifying "// +build ignore" those packages should be skipped because
+ // specifying "//go:build ignore" those packages should be skipped because
// embeds from ignored files can't be used.
// TODO(#42504): Find a better way to avoid errors from ImportDir. We'll
// need to figure this out when we switch to PackagesAndErrors as per the
// Now committed to returning dir (not "").
// Are there Go source files in the directory?
- // We don't care about build tags, not even "+build ignore".
+ // We don't care about build tags, not even "go:build ignore".
// We're just looking for a plausible directory.
haveGoFiles, err = haveGoFilesCache.Do(dir, func() (bool, error) {
// modindex.GetPackage will return ErrNotIndexed for any directories which
// license that can be found in the LICENSE file.
//go:build ignore
-// +build ignore
// Generate builtinlist.go from cmd/compile/internal/typecheck/builtin/runtime.go.
// license that can be found in the LICENSE file.
//go:build !purego
-// +build !purego
// SHA256 block routine. See sha256block.go for Go equivalent.
//
// license that can be found in the LICENSE file.
//go:build !purego
-// +build !purego
package notsha256
// license that can be found in the LICENSE file.
//go:build !purego
-// +build !purego
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build !purego && (386 || amd64 || ppc64le || ppc64)
-// +build !purego
-// +build 386 amd64 ppc64le ppc64
package notsha256
// license that can be found in the LICENSE file.
//go:build purego || (!amd64 && !386 && !ppc64le && !ppc64)
-// +build purego !amd64,!386,!ppc64le,!ppc64
package notsha256
//
//go:build !purego && (ppc64 || ppc64le)
-// +build !purego
-// +build ppc64 ppc64le
// Based on CRYPTOGAMS code with the following comment:
// # ====================================================================
// license that can be found in the LICENSE file.
//go:build ignore
-// +build ignore
// This is a mini version of the stringer tool customized for the Anames table
// in the architecture support for obj.
// license that can be found in the LICENSE file.
//go:build cgo
-// +build cgo
package ld
// license that can be found in the LICENSE file.
//go:build !wasm && !windows
-// +build !wasm,!windows
package ld
// license that can be found in the LICENSE file.
//go:build wasm || windows
-// +build wasm windows
package ld
// license that can be found in the LICENSE file.
//go:build (goexperiment.boringcrypto && !boringcrypto) || (!goexperiment.boringcrypto && boringcrypto)
-// +build goexperiment.boringcrypto,!boringcrypto !goexperiment.boringcrypto,boringcrypto
package boring_test
// On other platforms (those using this source file), they don't.
//go:build !amd64
-// +build !amd64
TEXT ·BoringCrypto(SB),$0
RET
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build arm64,gc,!purego
+//go:build arm64 && gc && !purego
#include "textflag.h"
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.arenas
-// +build !goexperiment.arenas
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.arenas
-// +build goexperiment.arenas
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.boringcrypto
-// +build !goexperiment.boringcrypto
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.boringcrypto
-// +build goexperiment.boringcrypto
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.cacheprog
-// +build !goexperiment.cacheprog
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.cacheprog
-// +build goexperiment.cacheprog
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.cgocheck2
-// +build !goexperiment.cgocheck2
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.cgocheck2
-// +build goexperiment.cgocheck2
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.coverageredesign
-// +build !goexperiment.coverageredesign
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.coverageredesign
-// +build goexperiment.coverageredesign
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.fieldtrack
-// +build !goexperiment.fieldtrack
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.fieldtrack
-// +build goexperiment.fieldtrack
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.heapminimum512kib
-// +build !goexperiment.heapminimum512kib
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.heapminimum512kib
-// +build goexperiment.heapminimum512kib
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.loopvar
-// +build !goexperiment.loopvar
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.loopvar
-// +build goexperiment.loopvar
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.newinliner
-// +build !goexperiment.newinliner
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.newinliner
-// +build goexperiment.newinliner
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.pagetrace
-// +build !goexperiment.pagetrace
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.pagetrace
-// +build goexperiment.pagetrace
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.preemptibleloops
-// +build !goexperiment.preemptibleloops
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.preemptibleloops
-// +build goexperiment.preemptibleloops
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.range
-// +build !goexperiment.range
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.range
-// +build goexperiment.range
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.regabiargs
-// +build !goexperiment.regabiargs
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.regabiargs
-// +build goexperiment.regabiargs
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.regabiwrappers
-// +build !goexperiment.regabiwrappers
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.regabiwrappers
-// +build goexperiment.regabiwrappers
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build !goexperiment.staticlockranking
-// +build !goexperiment.staticlockranking
package goexperiment
// Code generated by mkconsts.go. DO NOT EDIT.
//go:build goexperiment.staticlockranking
-// +build goexperiment.staticlockranking
package goexperiment
// license that can be found in the LICENSE file.
//go:build ignore
-// +build ignore
// mkconsts generates const definition files for each GOEXPERIMENT.
package main
data := fmt.Sprintf(`// Code generated by mkconsts.go. DO NOT EDIT.
//go:build %s%s
-// +build %s%s
package goexperiment
const %s = %v
const %sInt = %s
-`, pick(val, "!", ""), buildTag, pick(val, "!", ""), buildTag, f, val, f, pick(val, "0", "1"))
+`, pick(val, "!", ""), buildTag, f, val, f, pick(val, "0", "1"))
if err := os.WriteFile(name, []byte(data), 0666); err != nil {
log.Fatalf("writing %s: %v", name, err)
}
// license that can be found in the LICENSE file.
//go:build !race
-// +build !race
package race
// license that can be found in the LICENSE file.
//go:build race
-// +build race
package race
// license that can be found in the LICENSE file.
//go:build !math_big_pure_go
-// +build !math_big_pure_go
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build !math_big_pure_go
-// +build !math_big_pure_go
package big
// license that can be found in the LICENSE file.
//go:build !math_big_pure_go
-// +build !math_big_pure_go
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build !math_big_pure_go
-// +build !math_big_pure_go
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build !math_big_pure_go
-// +build !math_big_pure_go
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build !math_big_pure_go
-// +build !math_big_pure_go
package big
// license that can be found in the LICENSE file.
//go:build math_big_pure_go
-// +build math_big_pure_go
package big
// license that can be found in the LICENSE file.
//go:build !math_big_pure_go
-// +build !math_big_pure_go
package big
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !math_big_pure_go,loong64
+//go:build !math_big_pure_go && loong64
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build !math_big_pure_go && (mips64 || mips64le)
-// +build !math_big_pure_go
-// +build mips64 mips64le
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build !math_big_pure_go && (mips || mipsle)
-// +build !math_big_pure_go
-// +build mips mipsle
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build !math_big_pure_go && (ppc64 || ppc64le)
-// +build !math_big_pure_go
-// +build ppc64 ppc64le
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build !math_big_pure_go && riscv64
-// +build !math_big_pure_go,riscv64
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build !math_big_pure_go
-// +build !math_big_pure_go
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build s390x && !math_big_pure_go
-// +build s390x,!math_big_pure_go
package big
// license that can be found in the LICENSE file.
//go:build !math_big_pure_go
-// +build !math_big_pure_go
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build !compiler_bootstrap
-// +build !compiler_bootstrap
package bits
// license that can be found in the LICENSE file.
//go:build compiler_bootstrap
-// +build compiler_bootstrap
// This version used only for bootstrap (on this path we want
// to avoid use of go:linkname as applied to variables).
// license that can be found in the LICENSE file.
//go:build ignore
-// +build ignore
// This program generates example_test.go.
// license that can be found in the LICENSE file.
//go:build ignore
-// +build ignore
// This program generates bits_tables.go.
// license that can be found in the LICENSE file.
//go:build ppc64 || ppc64le
-// +build ppc64 ppc64le
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build ppc64 || ppc64le
-// +build ppc64 ppc64le
#include "textflag.h"
// license that can be found in the LICENSE file.
//go:build !nethttpomithttp2
-// +build !nethttpomithttp2
package http
// license that can be found in the LICENSE file.
//go:build !nethttpomithttp2
-// +build !nethttpomithttp2
package http
// license that can be found in the LICENSE file.
//go:build linux
-// +build linux
package net
//go:build wasm || ppc64 || ppc64le
-// +build wasm ppc64 ppc64le
//
// Copyright 2023 The Go Authors. All rights reserved.
// license that can be found in the LICENSE file.
//go:build race
-// +build race
#include "go_asm.h"
#include "funcdata.h"
// license that can be found in the LICENSE file.
//go:build linux && s390x
-// +build linux,s390x
package runtime
// license that can be found in the LICENSE file.
//go:build ignore
-// +build ignore
// This program is run via "go generate" (via a directive in sort.go)
// to generate implementation variants of the underlying sorting algorithm.
// license that can be found in the LICENSE file.
//go:build !compiler_bootstrap
-// +build !compiler_bootstrap
package strconv
// license that can be found in the LICENSE file.
//go:build compiler_bootstrap
-// +build compiler_bootstrap
package strconv
// license that can be found in the LICENSE file.
//go:build ignore
-// +build ignore
//
// usage: