From 05d25d8dcb8288e760ca484cd8914db7b54db4f4 Mon Sep 17 00:00:00 2001 From: yetone Date: Sat, 14 Nov 2026 16:36:50 +0800 Subject: [PATCH] provider: the Qwen sign-in's status words are compiled when first read (TestNoEagerPackageRegexps) 11ddf076b added a package-level regexp.MustCompile in qianwen_plan.go, which turned TestNoEagerPackageRegexps (lazyre_test.go) red on main. lazyre.New compiles the regexp on first use instead, as the guard asks. Run on mote: the full go test -timeout 45m ./... at 039025ac6 was red in this test alone (qianwen_plan.go:331:25). At 1a8fc99f4, with this fix, gofmt, go vet (darwin, linux -tags nogui, windows) and the full suite were all ok (EXIT=0). --- internal/provider/qianwen_plan.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/provider/qianwen_plan.go b/internal/provider/qianwen_plan.go index 80e948aac..5dfe9e67c 100644 --- a/internal/provider/qianwen_plan.go +++ b/internal/provider/qianwen_plan.go @@ -43,7 +43,6 @@ import ( "net/url" "os" "path/filepath" - "regexp" "strconv" "strings" "sync" @@ -51,6 +50,7 @@ import ( "github.com/yetone/magpie/internal/filememo" "github.com/yetone/magpie/internal/lastgood" + "github.com/yetone/magpie/internal/lazyre" ) const ( @@ -328,7 +328,7 @@ func CancelQianwenSignIn(id string) { } } -var qianwenStatusWord = regexp.MustCompile(`(?i)expired|access_denied|slow_down`) +var qianwenStatusWord = lazyre.New(`(?i)expired|access_denied|slow_down`) // qianwenWait asks the platform whether the user approved the sign-in, // until they have, refused, or the page ran out, and keeps it.