diff --git a/cli/xgotext/fixtures/main.go b/cli/xgotext/fixtures/main.go index 19b0b0a..29944d1 100644 --- a/cli/xgotext/fixtures/main.go +++ b/cli/xgotext/fixtures/main.go @@ -1,6 +1,7 @@ package main import ( + "errors" "fmt" "github.com/leonelquinteros/gotext" @@ -78,6 +79,9 @@ func main() { // redefine alias with fake struct alias := Fake2{} alias.Get("3") + + err := errors.New("test") + fmt.Print(err.Error()) } // dummy function diff --git a/cli/xgotext/parser/golang.go b/cli/xgotext/parser/golang.go index 62fbdd9..bb63c72 100644 --- a/cli/xgotext/parser/golang.go +++ b/cli/xgotext/parser/golang.go @@ -165,7 +165,7 @@ func (g *GoFile) checkType(rawType types.Type) bool { return g.checkType(t.Elem()) case *types.Named: - if t.Obj().Pkg().Path() != "github.com/leonelquinteros/gotext" { + if t.Obj().Pkg() == nil || t.Obj().Pkg().Path() != "github.com/leonelquinteros/gotext" { return false } default: