mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-01 06:46:44 -04:00
all: update go directive to 1.18
Done with: go get go@1.18 go mod tidy go fix ./... Using go1.21.3. Also update code generators to use only the new go:build lines, not the old +build ones. For golang/go#60268. Change-Id: I6aabc42efb6ab3329981100e1db2263aac5e92a6 Reviewed-on: https://go-review.googlesource.com/c/sys/+/534222 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>
This commit is contained in:
committed by
Gopher Robot
parent
1d9f0b6d88
commit
1bfbee0e20
@@ -282,7 +282,15 @@ func getCodeSet(src interface{}) (*codeSet, error) {
|
||||
// Add file level comments
|
||||
cmap := ast.NewCommentMap(fset, f, f.Comments)
|
||||
for _, cGrp := range cmap[f] {
|
||||
set.add(codeElem{token.COMMENT, cGrp.Text()})
|
||||
text := cGrp.Text()
|
||||
if text == "" && len(cGrp.List) == 1 && strings.HasPrefix(cGrp.List[0].Text, "//go:build ") {
|
||||
// ast.CommentGroup.Text doesn't include comment directives like "//go:build"
|
||||
// in the text. So if a comment group has empty text and a single //go:build
|
||||
// constraint line, make a custom codeElem. This is enough for mkmerge needs.
|
||||
set.add(codeElem{token.COMMENT, cGrp.List[0].Text[len("//"):] + "\n"})
|
||||
continue
|
||||
}
|
||||
set.add(codeElem{token.COMMENT, text})
|
||||
}
|
||||
|
||||
return set, nil
|
||||
@@ -465,7 +473,6 @@ func merge(mergedFile string, archFiles ...string) error {
|
||||
fmt.Fprintln(buf, "// Code generated by mkmerge; DO NOT EDIT.")
|
||||
fmt.Fprintln(buf)
|
||||
fmt.Fprintf(buf, "//go:build %s\n", goos)
|
||||
fmt.Fprintf(buf, "// +build %s\n", goos)
|
||||
fmt.Fprintln(buf)
|
||||
buf.Write(mergedSrc)
|
||||
|
||||
|
||||
@@ -100,7 +100,6 @@ func TestMerge(t *testing.T) {
|
||||
// build directives for arch{{.}}
|
||||
|
||||
//go:build goos && arch{{.}}
|
||||
// +build goos,arch{{.}}
|
||||
|
||||
package main
|
||||
|
||||
@@ -186,7 +185,6 @@ const (
|
||||
// build directives for arch{{.}}
|
||||
|
||||
//go:build goos && arch{{.}}
|
||||
// +build goos,arch{{.}}
|
||||
|
||||
package main
|
||||
|
||||
@@ -317,7 +315,7 @@ const (
|
||||
expectedElems := []codeElem{
|
||||
{token.COMMENT, "Package comments\n"},
|
||||
{token.COMMENT, "build directives for archA\n"},
|
||||
{token.COMMENT, "+build goos,archA\n"},
|
||||
{token.COMMENT, "go:build goos && archA\n"},
|
||||
{token.CONST, `COMMON_INDEPENDENT = 1234`},
|
||||
{token.CONST, `UNIQUE_INDEPENDENT_A = "UNIQUE_INDEPENDENT_A"`},
|
||||
{token.CONST, `COMMON_GROUP = "COMMON_GROUP"`},
|
||||
|
||||
Reference in New Issue
Block a user