]> Cypherpunks repositories - gostls13.git/commitdiff
regexp: dont use builtin type as variable name
authorAhmet Soormally <ahmet@mangomm.co.uk>
Mon, 15 Jan 2018 12:12:46 +0000 (12:12 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 19 Feb 2018 23:40:33 +0000 (23:40 +0000)
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>

src/regexp/regexp.go

index 023920c91e3bb87e80223e8fbf5ba86fbddcc9a2..2e4c6e8926f106ec63045a774ed781ea3ded4470 100644 (file)
@@ -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
 }