diff options
Diffstat (limited to 'src/pkg/path/match.go')
-rw-r--r-- | src/pkg/path/match.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pkg/path/match.go b/src/pkg/path/match.go index efb8c5ce7..ba7e4de32 100644 --- a/src/pkg/path/match.go +++ b/src/pkg/path/match.go @@ -5,12 +5,12 @@ package path import ( - "os" + "errors" "strings" - "utf8" + "unicode/utf8" ) -var ErrBadPattern = os.NewError("syntax error in pattern") +var ErrBadPattern = errors.New("syntax error in pattern") // Match returns true if name matches the shell file name pattern. // The pattern syntax is: @@ -33,7 +33,7 @@ var ErrBadPattern = os.NewError("syntax error in pattern") // Match requires pattern to match all of name, not just a substring. // The only possible error return is when pattern is malformed. // -func Match(pattern, name string) (matched bool, err os.Error) { +func Match(pattern, name string) (matched bool, err error) { Pattern: for len(pattern) > 0 { var star bool @@ -111,7 +111,7 @@ Scan: // matchChunk checks whether chunk matches the beginning of s. // If so, it returns the remainder of s (after the match). // Chunk is all single-character operators: literals, char classes, and ?. -func matchChunk(chunk, s string) (rest string, ok bool, err os.Error) { +func matchChunk(chunk, s string) (rest string, ok bool, err error) { for len(chunk) > 0 { if len(s) == 0 { return @@ -136,7 +136,7 @@ func matchChunk(chunk, s string) (rest string, ok bool, err os.Error) { chunk = chunk[1:] break } - var lo, hi int + var lo, hi rune if lo, chunk, err = getEsc(chunk); err != nil { return } @@ -183,7 +183,7 @@ func matchChunk(chunk, s string) (rest string, ok bool, err os.Error) { } // getEsc gets a possibly-escaped character from chunk, for a character class. -func getEsc(chunk string) (r int, nchunk string, err os.Error) { +func getEsc(chunk string) (r rune, nchunk string, err error) { if len(chunk) == 0 || chunk[0] == '-' || chunk[0] == ']' { err = ErrBadPattern return |