From 818cbeab4a0249f12511dfe7b30feb36445d1482 Mon Sep 17 00:00:00 2001 From: Kei Kamikawa Date: Tue, 22 Feb 2022 13:05:30 +0900 Subject: [PATCH] fixed filepath generation --- plugin/modelgen/models_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugin/modelgen/models_test.go b/plugin/modelgen/models_test.go index e9a51a33fe..42641437b8 100644 --- a/plugin/modelgen/models_test.go +++ b/plugin/modelgen/models_test.go @@ -4,8 +4,8 @@ import ( "go/ast" "go/parser" "go/token" - "io/fs" "io/ioutil" + "path/filepath" "strings" "testing" @@ -95,7 +95,8 @@ func TestModelGeneration(t *testing.T) { pkg, err := parseAst("out") require.NoError(t, err) - generated := pkg.Files["out/generated.go"] + path := filepath.Join("out", "generated.go") + generated := pkg.Files[path] type field struct { typ string @@ -191,7 +192,7 @@ func mutateHook(b *ModelBuild) *ModelBuild { func parseAst(path string) (*ast.Package, error) { // test setup to parse the types fset := token.NewFileSet() - pkgs, err := parser.ParseDir(fset, path, func(fs.FileInfo) bool { return true }, parser.AllErrors) + pkgs, err := parser.ParseDir(fset, path, nil, parser.AllErrors) if err != nil { return nil, err }