From 3f35e26c9b1d841f5ebd896318311fc146475a99 Mon Sep 17 00:00:00 2001 From: John Gardiner Myers Date: Wed, 25 Dec 2019 16:15:40 -0800 Subject: [PATCH] Fix upup/tools/generators/pkg/codegen staticcheck failures --- hack/.staticcheck_failures | 1 - upup/tools/generators/pkg/codegen/parse.go | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/hack/.staticcheck_failures b/hack/.staticcheck_failures index f835c687db..5cf77c8e64 100644 --- a/hack/.staticcheck_failures +++ b/hack/.staticcheck_failures @@ -9,4 +9,3 @@ upup/pkg/fi upup/pkg/fi/cloudup upup/pkg/fi/cloudup/awstasks upup/pkg/kutil -upup/tools/generators/pkg/codegen diff --git a/upup/tools/generators/pkg/codegen/parse.go b/upup/tools/generators/pkg/codegen/parse.go index 928016606c..24b0a16ee0 100644 --- a/upup/tools/generators/pkg/codegen/parse.go +++ b/upup/tools/generators/pkg/codegen/parse.go @@ -36,9 +36,6 @@ type GoParser struct { type File struct { pkg *Package // Package to which this file belongs. file *ast.File // Parsed AST. - // These fields are reset for each type being generated. - typeName string // Name of the constant type. - //values []Value // Accumulator for constant values of that type. } type Package struct { @@ -110,7 +107,7 @@ func (g *GoParser) parsePackage(directory string, names []string, text interface // check type-checks the package. The package must be OK to proceed. func (pkg *Package) check(fs *token.FileSet, astFiles []*ast.File) { pkg.defs = make(map[*ast.Ident]types.Object) - config := types.Config{Importer: importer.For("source", nil), FakeImportC: true} + config := types.Config{Importer: importer.ForCompiler(token.NewFileSet(), "source", nil), FakeImportC: true} info := &types.Info{ Defs: pkg.defs, }