open2b/scriggo

test: replace `// +build` syntax with `//go:build`

Opened this issue · 0 comments

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.