all: remove +build tags (#377)

Commit 759be3dad9 bumped our Go
requirement to 1.18 which allows us to drop support for old-style
`+build` tags. This change runs `go fix ./...` to remove them, and
updates some remaining code generators that produced `+build` lines.
This commit is contained in:
Michael McLoughlin
2023-03-05 20:30:01 -08:00
committed by GitHub
parent 759be3dad9
commit 34ac353c14
50 changed files with 13 additions and 54 deletions

View File

@@ -37,7 +37,6 @@ $ go get -u github.com/mmcloughlin/avo
```go
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,7 +1,6 @@
// Code generated by command: avogen -output zinstructions_test.go buildtest. DO NOT EDIT.
//go:build !integration
// +build !integration
package build

View File

@@ -1,5 +1,4 @@
//go:build !go1.17
// +build !go1.17
package buildtags

View File

@@ -1,5 +1,4 @@
//go:build go1.17 && !go1.18
// +build go1.17,!go1.18
package buildtags

View File

@@ -1,5 +1,4 @@
//go:build go1.18
// +build go1.18
package buildtags

View File

@@ -7,7 +7,6 @@ The [code generator](asm.go) is as follows:
[embedmd]:# (asm.go)
```go
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,4 +1,4 @@
// +build ignore
//go:build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -20,7 +20,7 @@ func NewBuildTest(cfg printer.Config) Interface {
func (b *buildtest) Generate(is []inst.Instruction) ([]byte, error) {
b.Printf("// %s\n\n", b.cfg.GeneratedWarning())
b.BuildTag("!integration")
b.BuildConstraint("!integration")
b.NL()
b.Printf("package build\n\n")
b.Printf("import (\n")

View File

@@ -23,7 +23,7 @@ func NewCtorsTest(cfg printer.Config) Interface {
func (c *ctorstest) Generate(is []inst.Instruction) ([]byte, error) {
c.Printf("// %s\n\n", c.cfg.GeneratedWarning())
c.BuildTag("!integration")
c.BuildConstraint("!integration")
c.NL()
c.Printf("package x86\n\n")
c.Printf("import (\n")
@@ -65,7 +65,7 @@ func NewCtorsStress(cfg printer.Config) Interface {
func (c *ctorsstress) Generate(is []inst.Instruction) ([]byte, error) {
c.Printf("// %s\n\n", c.cfg.GeneratedWarning())
c.BuildTag("stress")
c.BuildConstraint("stress")
c.NL()
c.Printf("package x86\n\n")
c.Printf("import (\n")
@@ -112,7 +112,7 @@ func NewCtorsBench(cfg printer.Config) Interface {
func (c *ctorsbench) Generate(is []inst.Instruction) ([]byte, error) {
c.Printf("// %s\n\n", c.cfg.GeneratedWarning())
c.BuildTag("stress")
c.BuildConstraint("stress")
c.NL()
c.Printf("package x86\n\n")
c.Printf("import (\n")

View File

@@ -2,7 +2,6 @@
// stress-test only build.
//go:build stress
// +build stress
package inst

View File

@@ -4,6 +4,7 @@ package prnt
import (
"bytes"
"fmt"
"go/build/constraint"
"io"
"strings"
)
@@ -75,9 +76,13 @@ func (g *Generator) Comment(lines ...string) {
}
}
// BuildTag outputs a build tag.
func (g *Generator) BuildTag(tag string) {
g.Comment("+build " + tag)
// BuildConstraint outputs a build constraint.
func (g *Generator) BuildConstraint(expr string) {
line := fmt.Sprintf("//go:build %s", expr)
if _, err := constraint.Parse(line); err != nil {
g.AddError(err)
}
g.Linef(line)
}
// AddError records an error in code generation. The first non-nil error will

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -1,5 +1,4 @@
//go:build ignore
// +build ignore
package main

View File

@@ -2,7 +2,6 @@
// are limited to stress-test mode.
//go:build stress
// +build stress
package x86

View File

@@ -1,7 +1,6 @@
// Code generated by command: avogen -output zctors_test.go ctorstest. DO NOT EDIT.
//go:build !integration
// +build !integration
package x86