xgotext: fixed parsing of error types

This commit is contained in:
Benjamin Böhmke
2020-02-26 21:08:59 +01:00
parent 4aa838b8c3
commit f46758caed
2 changed files with 5 additions and 1 deletions

View File

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

View File

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