From 03cbfaca42135e138f455765a8bc19d7d98f1295 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 9 Nov 2024 22:45:58 +0900 Subject: [PATCH] internal/vettools: return non-nil value When executing internal/vettools directly by `go run`, this caused an error since the return type must match with ResultType. --- internal/vettools/imageimportcheck.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/vettools/imageimportcheck.go b/internal/vettools/imageimportcheck.go index 7ec40cb9f..fbc1ae7b1 100644 --- a/internal/vettools/imageimportcheck.go +++ b/internal/vettools/imageimportcheck.go @@ -46,15 +46,15 @@ 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 @@ -62,7 +62,7 @@ func runImageImportCheck(pass *analysis.Pass) (any, error) { 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{