Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regexp/syntax: Compile can only return a nil error #44341

Closed
Muddz opened this issue Feb 17, 2021 · 1 comment
Closed

regexp/syntax: Compile can only return a nil error #44341

Muddz opened this issue Feb 17, 2021 · 1 comment

Comments

@Muddz
Copy link

Muddz commented Feb 17, 2021

I can't see any reason why func Compile(re *Regexp) (*Prog, error){} in regexp/syntax/compile.go should return any error objects at all. It will always just return a nil which makes this error check in regexp/regexp.go unnecessary too.

$ go version 1.6
go env Output
$ go env
set GOARCH=amd64
set GOHOSTOS=windows
@Muddz Muddz changed the title Compile() function in regex/syntax/compile.go always returns a nil error Compile() function in regex/syntax/compile.go can only return a nil error Feb 17, 2021
@seankhliao seankhliao changed the title Compile() function in regex/syntax/compile.go can only return a nil error regexp/syntax: Compile can only return a nil error Feb 17, 2021
@ianlancetaylor
Copy link
Contributor

Perhaps it was a mistake, but changing it now would break the Go 1 compatibility guarantee (https://golang.org/doc/go1compat).

@golang golang locked and limited conversation to collaborators Feb 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants