Skip to content

Commit

Permalink
all: use the syntax //go:build instead of // +build
Browse files Browse the repository at this point in the history
This commit removes the line syntax:

	// +build

by using just the syntax:

	//go:build

which is supported starting from Go 1.17 and has been considered
deprecated starting from Go 1.18.

Note that, in tests, the old syntax is kept. See #956.
  • Loading branch information
zapateo authored Sep 30, 2024
1 parent b69b3c7 commit 960446d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion cmd/scriggo/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ func renderPackages(w io.Writer, dir string, sf *scriggofile, goos string, flags
// Skeleton for a package group.
const pkgsSkeleton = `// Code generated by scriggo command. DO NOT EDIT.
//go:build {{.GOOS}} && {{.BaseVersion}} && !{{.NextGoVersion}}
// +build {{.GOOS}},{{.BaseVersion}},!{{.NextGoVersion}}
package {{.Name}}
Expand Down
1 change: 0 additions & 1 deletion playground/scriggo.wasm.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build js && wasm
// +build js,wasm

package main

Expand Down
1 change: 0 additions & 1 deletion test/compare/cgo_off.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build !cgo
// +build !cgo

package main

Expand Down
1 change: 0 additions & 1 deletion test/compare/cgo_on.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//go:build cgo
// +build cgo

package main

Expand Down
7 changes: 5 additions & 2 deletions test/compare/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,11 @@ func goldenCompare(testPath string, got []byte) error {
return nil
}

// isBuildConstraints reports whether line is a build contrain, as specified at
// https://pkg.go.dev/go/build#hdr-Build_Constraints.
// isBuildConstraints reports whether line is a build constraint, as specified
// at https://pkg.go.dev/go/build#hdr-Build_Constraints.
//
// TODO(Gianluca): this function still needs to support the old format of build
// tags. Please refer to the issue https://github.com/open2b/scriggo/issues/956.
func isBuildConstraints(line string) bool {
line = strings.TrimSpace(line)
if !strings.HasPrefix(line, "//") {
Expand Down

0 comments on commit 960446d

Please sign in to comment.