Add support for Go 1.16.

This commit is contained in:
Elliott Sales de Andrade
2021-02-15 03:34:00 -05:00
committed by Ron Evans
parent 4141a9f431
commit b689f14bb2
5 changed files with 29 additions and 7 deletions
+15
View File
@@ -5,6 +5,7 @@ import (
"flag"
"fmt"
"go/ast"
"go/build"
"go/format"
"go/parser"
"go/token"
@@ -41,6 +42,20 @@ func TestCGo(t *testing.T) {
for _, name := range []string{"basic", "errors", "types", "flags", "const"} {
name := name // avoid a race condition
t.Run(name, func(t *testing.T) {
// Skip tests that require specific Go version.
if name == "errors" {
ok := false
for _, version := range build.Default.ReleaseTags {
if version == "go1.16" {
ok = true
break
}
}
if !ok {
t.Skip("Results for errors test are only valid for Go 1.16+")
}
}
// Read the AST in memory.
path := filepath.Join("testdata", name+".go")
fset := token.NewFileSet()