From 10e783080aeb699f84914f25b4a89007e2860de7 Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 12 Nov 2026 19:37:20 +0800 Subject: [PATCH] update: the urgent-release line compiles on first use TestNoEagerPackageRegexps (root package) was red on main since 36eebea13: internal/update/behind.go:122 compiled urgentLine with regexp.MustCompile at package level. Main's Test run 43201591823 (at 67f61bd78) 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/main f6c882ad7 + 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. --- internal/update/behind.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/update/behind.go b/internal/update/behind.go index 5d926d231..0f9a59d67 100644 --- a/internal/update/behind.go +++ b/internal/update/behind.go @@ -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).