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.
This commit is contained in:
Hajime Hoshi 2024-11-09 22:45:58 +09:00
parent db04c37f26
commit 03cbfaca42

View File

@ -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{