diff --git a/modfile/ext.go b/modfile/ext.go index cd94a93..dccd2db 100644 --- a/modfile/ext.go +++ b/modfile/ext.go @@ -17,6 +17,7 @@ package modfile import ( + "fmt" "path" "strings" @@ -44,6 +45,17 @@ failed: } } +type InvalidExtError struct { + Ext string + Err error +} + +func (e *InvalidExtError) Error() string { + return fmt.Sprintf("ext %s invalid: %s", e.Ext, e.Err) +} + +func (e *InvalidExtError) Unwrap() error { return e.Err } + // SplitFname splits fname into (hasGoxExt, className, classExt). func SplitFname(fname string) (hasGoxExt bool, className, classExt string) { classExt = path.Ext(fname) diff --git a/modfile/rule.go b/modfile/rule.go index 83b4c17..0e103a3 100644 --- a/modfile/rule.go +++ b/modfile/rule.go @@ -340,17 +340,6 @@ func isPkgPath(s string) bool { return s != "" && (s[0] != '.' && s[0] != '_') } -type InvalidExtError struct { - Ext string - Err error -} - -func (e *InvalidExtError) Error() string { - return fmt.Sprintf("ext %s invalid: %s", e.Ext, e.Err) -} - -func (e *InvalidExtError) Unwrap() error { return e.Err } - type InvalidSymbolError struct { Sym string Err error