Skip to content

Commit

Permalink
mv InvalidExtError
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Jan 7, 2024
1 parent 5c217b4 commit 9360d34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
12 changes: 12 additions & 0 deletions modfile/ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package modfile

import (
"fmt"
"path"
"strings"

Expand Down Expand Up @@ -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)
Expand Down
11 changes: 0 additions & 11 deletions modfile/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9360d34

Please sign in to comment.