diff options
author | Ahmet Soormally <ahmet@mangomm.co.uk> | 2018-01-15 12:12:46 +0000 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2018-02-19 23:40:33 +0000 |
commit | bb355ed5ebb24179be4e1093c3dce12e23f21d56 (patch) | |
tree | 0be48a224caaa1dc91dd4bef21538771786480de /src/regexp/regexp.go | |
parent | eb5925f5ff6e3690ce2d9fa680829560cbb11970 (diff) | |
download | go-git-bb355ed5ebb24179be4e1093c3dce12e23f21d56.tar.gz |
regexp: dont use builtin type as variable name
The existing implementation declares a variable error which collides
with builting type error.
This change simply renames error variable to err.
Change-Id: Ib56c2530f37f53ec70fdebb825a432d4c550cd04
Reviewed-on: https://go-review.googlesource.com/87775
Reviewed-by: Daniel Martà <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Daniel Martà <mvdan@mvdan.cc>
Diffstat (limited to 'src/regexp/regexp.go')
-rw-r--r-- | src/regexp/regexp.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/regexp/regexp.go b/src/regexp/regexp.go index 023920c91e..2e4c6e8926 100644 --- a/src/regexp/regexp.go +++ b/src/regexp/regexp.go @@ -235,9 +235,9 @@ func (re *Regexp) put(z *machine) { // It simplifies safe initialization of global variables holding compiled regular // expressions. func MustCompile(str string) *Regexp { - regexp, error := Compile(str) - if error != nil { - panic(`regexp: Compile(` + quote(str) + `): ` + error.Error()) + regexp, err := Compile(str) + if err != nil { + panic(`regexp: Compile(` + quote(str) + `): ` + err.Error()) } return regexp } @@ -246,9 +246,9 @@ func MustCompile(str string) *Regexp { // It simplifies safe initialization of global variables holding compiled regular // expressions. func MustCompilePOSIX(str string) *Regexp { - regexp, error := CompilePOSIX(str) - if error != nil { - panic(`regexp: CompilePOSIX(` + quote(str) + `): ` + error.Error()) + regexp, err := CompilePOSIX(str) + if err != nil { + panic(`regexp: CompilePOSIX(` + quote(str) + `): ` + err.Error()) } return regexp } |