mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-14 23:17:27 +01:00
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:
parent
db04c37f26
commit
03cbfaca42
@ -46,15 +46,15 @@ type imageImportCheckError struct {
|
|||||||
func runImageImportCheck(pass *analysis.Pass) (any, error) {
|
func runImageImportCheck(pass *analysis.Pass) (any, error) {
|
||||||
pkgPath := pass.Pkg.Path()
|
pkgPath := pass.Pkg.Path()
|
||||||
if strings.HasPrefix(pkgPath, "github.com/hajimehoshi/ebiten/v2/examples/") {
|
if strings.HasPrefix(pkgPath, "github.com/hajimehoshi/ebiten/v2/examples/") {
|
||||||
return nil, nil
|
return imageImportCheckResult{}, nil
|
||||||
}
|
}
|
||||||
if strings.HasSuffix(pkgPath, "_test") {
|
if strings.HasSuffix(pkgPath, "_test") {
|
||||||
return nil, nil
|
return imageImportCheckResult{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove this exception after v3 is released (#2336).
|
// TODO: Remove this exception after v3 is released (#2336).
|
||||||
if pkgPath == "github.com/hajimehoshi/ebiten/v2/ebitenutil" {
|
if pkgPath == "github.com/hajimehoshi/ebiten/v2/ebitenutil" {
|
||||||
return nil, nil
|
return imageImportCheckResult{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var errs []imageImportCheckError
|
var errs []imageImportCheckError
|
||||||
@ -62,7 +62,7 @@ func runImageImportCheck(pass *analysis.Pass) (any, error) {
|
|||||||
for _, i := range f.Imports {
|
for _, i := range f.Imports {
|
||||||
path, err := strconv.Unquote(i.Path.Value)
|
path, err := strconv.Unquote(i.Path.Value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return imageImportCheckResult{}, err
|
||||||
}
|
}
|
||||||
if path == "image/gif" || path == "image/jpeg" || path == "image/png" {
|
if path == "image/gif" || path == "image/jpeg" || path == "image/png" {
|
||||||
err := imageImportCheckError{
|
err := imageImportCheckError{
|
||||||
|
Loading…
Reference in New Issue
Block a user