releaser: Fix regexp

Original regexp used a char class which caused the regexp to only
check 1 symbol instead of a substring like "See" and "Closes".
So it would match `e #x` instead of `See #x` and many other
weird combinations.

Tests were passing as they never checked against an input that
would confuse that regexp.

Found with go-critic static analyzer, `badRegexp` checker.
This commit is contained in:
Iskander (Alex) Sharipov
2021-10-12 12:32:09 +03:00
committed by GitHub
parent cd4e67af18
commit d7331aaa7e
2 changed files with 11 additions and 1 deletions

View File

@@ -23,7 +23,7 @@ import (
"github.com/gohugoio/hugo/common/hexec"
)
var issueRe = regexp.MustCompile(`(?i)[Updates?|Closes?|Fix.*|See] #(\d+)`)
var issueRe = regexp.MustCompile(`(?i)(?:Updates?|Closes?|Fix.*|See) #(\d+)`)
const (
notesChanges = "notesChanges"