update: the urgent-release line compiles on first use
TestNoEagerPackageRegexps (root package) was red on main since36eebea13: internal/update/behind.go:122 compiled urgentLine with regexp.MustCompile at package level. Main's Test run 43201591823 (at67f61bd78) failed on it on macOS and ubuntu. It now uses lazyre.New; its one call is MatchString, which lazyre has. Run on mote at origin/mainf6c882ad7+ this: go test -run TestNoEagerPackageRegexps . ok (red with the old line put back: behind.go:122:18); go test ./internal/update ok; go vet of internal/update, linux nogui and windows; gofmt -l empty.
This commit is contained in:
@@ -13,11 +13,11 @@ import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/yetone/magpie/internal/appdir"
|
||||
"github.com/yetone/magpie/internal/lazyre"
|
||||
)
|
||||
|
||||
// Quiet is how long a version has to be behind before the pill lights, and
|
||||
@@ -119,7 +119,7 @@ func (b Behind) Lit(current string, now time.Time) bool {
|
||||
return !b.Since.IsZero() && now.Sub(b.Since) >= Quiet
|
||||
}
|
||||
|
||||
var urgentLine = regexp.MustCompile(`(?im)^[ \t]*(?:>[ \t]*)?\*\*urgent release:\*\*`)
|
||||
var urgentLine = lazyre.New(`(?im)^[ \t]*(?:>[ \t]*)?\*\*urgent release:\*\*`)
|
||||
|
||||
// UrgentIn is whether a release's notes mark it urgent, as the site reads
|
||||
// them (site/worker.js, urgentIn).
|
||||
|
||||
Reference in New Issue
Block a user