Skip to content

Commit

Permalink
internal/vettools: return non-nil value
Browse files Browse the repository at this point in the history
When executing internal/vettools directly by `go run`, this caused
an error since the return type must match with ResultType.
  • Loading branch information
hajimehoshi committed Nov 9, 2024
1 parent db04c37 commit 03cbfac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/vettools/imageimportcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,23 @@ type imageImportCheckError struct {
func runImageImportCheck(pass *analysis.Pass) (any, error) {
pkgPath := pass.Pkg.Path()
if strings.HasPrefix(pkgPath, "github.com/hajimehoshi/ebiten/v2/examples/") {
return nil, nil
return imageImportCheckResult{}, nil
}
if strings.HasSuffix(pkgPath, "_test") {
return nil, nil
return imageImportCheckResult{}, nil
}

// TODO: Remove this exception after v3 is released (#2336).
if pkgPath == "github.com/hajimehoshi/ebiten/v2/ebitenutil" {
return nil, nil
return imageImportCheckResult{}, nil
}

var errs []imageImportCheckError
for _, f := range pass.Files {
for _, i := range f.Imports {
path, err := strconv.Unquote(i.Path.Value)
if err != nil {
return nil, err
return imageImportCheckResult{}, err
}
if path == "image/gif" || path == "image/jpeg" || path == "image/png" {
err := imageImportCheckError{
Expand Down

0 comments on commit 03cbfac

Please sign in to comment.