Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: replace // +build syntax with //go:build #956

Open
zapateo opened this issue Sep 30, 2024 · 0 comments
Open

test: replace // +build syntax with //go:build #956

zapateo opened this issue Sep 30, 2024 · 0 comments
Labels

Comments

@zapateo
Copy link
Member

zapateo commented Sep 30, 2024

PR #955 removed the use of the // +build syntax, which has been deprecated since Go version 1.18.

However, the tests in the test/compare directory have been maintained as they are because the parsing of test directives, which occurs here:

scriggo/test/compare/run.go

Lines 160 to 168 in 527b6c2

if !imports.ShouldBuild(src, tags) {
atomic.AddInt64(&countIncompatible, 1)
if *verbose {
fmt.Println("[ skipped, not compatible ]")
}
<-queue
wg.Done()
return
}

uses the package:

https://pkg.go.dev/github.com/rogpeppe/go-internal@v1.13.1/imports

whose function ShouldBuild still only supports the old format of build tags:

https://pkg.go.dev/github.com/rogpeppe/go-internal@v1.13.1/imports#ShouldBuild

So, it is a matter of finding an alternative way to parse the lines containing build directives in the tests. Until then, we will maintain the old directive format in the tests.

zapateo added a commit that referenced this issue Sep 30, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant