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).
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user