You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package test
import "regexp"
var _ = regexp.MustCompile(`(a|)`)
gocritic gives this output:
% go run github.com/go-critic/go-critic/cmd/gocritic@latest check --enable '#style' /tmp/test.go
/tmp/test.go:5:28: regexpSimplify: can re-write `(a|)` as `(|?)`
The simplification presumably was meant to be (a)?.
Another example is the string (?:\.(\d+)|), which gocritic wants to simplify to (?:|?). Which may give some idea about what it's matching incorrectly here.
The text was updated successfully, but these errors were encountered:
For this file:
gocritic gives this output:
The simplification presumably was meant to be
(a)?
.Another example is the string
(?:\.(\d+)|)
, which gocritic wants to simplify to(?:|?)
. Which may give some idea about what it's matching incorrectly here.The text was updated successfully, but these errors were encountered: