Skip to content

Commit

Permalink
Fix staticcheck error ST1005
Browse files Browse the repository at this point in the history
  • Loading branch information
David Poros committed Oct 21, 2019
1 parent 967977d commit 92e1544
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ func ParseSource(data interface{}) (*ast.File, *token.FileSet, error) {
func ParseAndTypeCheckFile(file string, flags ...string) (*ast.File, *token.FileSet, *types.Package, *types.Info, error) {
fileAbs, err := filepath.Abs(file)
if err != nil {
return nil, nil, nil, nil, fmt.Errorf("Could not absolute the file path of %q: %v", file, err)
return nil, nil, nil, nil, fmt.Errorf("could not absolute the file path of %q: %v", file, err)
}
dir := filepath.Dir(fileAbs)

buildPkg, err := build.ImportDir(dir, build.FindOnly)
if err != nil {
return nil, nil, nil, nil, fmt.Errorf("Could not create build package of %q: %v", file, err)
return nil, nil, nil, nil, fmt.Errorf("could not create build package of %q: %v", file, err)
}

pkgPath := buildPkg.ImportPath
Expand All @@ -65,7 +65,7 @@ func ParseAndTypeCheckFile(file string, flags ...string) (*ast.File, *token.File
}, pkgPath)
if err != nil {
fmt.Println(err)
return nil, nil, nil, nil, fmt.Errorf("Could not load package of file %q: %v", file, err)
return nil, nil, nil, nil, fmt.Errorf("could not load package of file %q: %v", file, err)
}

pkgInfo := prog[0]
Expand Down

0 comments on commit 92e1544

Please sign in to comment.