mirror of
https://github.com/golang/go.git
synced 2025-05-19 22:33:25 +00:00
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>
This commit is contained in:
parent
eb5925f5ff
commit
bb355ed5eb
@ -235,9 +235,9 @@ func (re *Regexp) put(z *machine) {
|
|||||||
// It simplifies safe initialization of global variables holding compiled regular
|
// It simplifies safe initialization of global variables holding compiled regular
|
||||||
// expressions.
|
// expressions.
|
||||||
func MustCompile(str string) *Regexp {
|
func MustCompile(str string) *Regexp {
|
||||||
regexp, error := Compile(str)
|
regexp, err := Compile(str)
|
||||||
if error != nil {
|
if err != nil {
|
||||||
panic(`regexp: Compile(` + quote(str) + `): ` + error.Error())
|
panic(`regexp: Compile(` + quote(str) + `): ` + err.Error())
|
||||||
}
|
}
|
||||||
return regexp
|
return regexp
|
||||||
}
|
}
|
||||||
@ -246,9 +246,9 @@ func MustCompile(str string) *Regexp {
|
|||||||
// It simplifies safe initialization of global variables holding compiled regular
|
// It simplifies safe initialization of global variables holding compiled regular
|
||||||
// expressions.
|
// expressions.
|
||||||
func MustCompilePOSIX(str string) *Regexp {
|
func MustCompilePOSIX(str string) *Regexp {
|
||||||
regexp, error := CompilePOSIX(str)
|
regexp, err := CompilePOSIX(str)
|
||||||
if error != nil {
|
if err != nil {
|
||||||
panic(`regexp: CompilePOSIX(` + quote(str) + `): ` + error.Error())
|
panic(`regexp: CompilePOSIX(` + quote(str) + `): ` + err.Error())
|
||||||
}
|
}
|
||||||
return regexp
|
return regexp
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user