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

@@ -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