Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
Metadata
ID:go-best-practices/regexp-zero-results
Language: Go
Severity: Info
Category: Best Practices
Description
Go, invoking the function re.FindAll() with the second argument set to 0 will not return any results.
funcmain(){res1:=regexp.MustCompile("foo(").FindAll(nil,1)varr2regexp.Regexpres:=r2.FindAll(something,1)// FindAll called on a non-Regexp object
varmyObjMyClassres2:=myObj.FindAll(something,0)}
Seamless integrations. Try Datadog Code Security
Datadog Code Security
Try this rule and analyze your code with Datadog Code Security
How to use this rule
1
2
rulesets:- go-best-practices # Rules to enforce Go best practices.
Create a static-analysis.datadog.yml with the content above at the root of your repository
Use our free IDE Plugins or add Code Security scans to your CI pipelines