gui: a proxy's web page regexps compile when first used (TestNoEagerPackageRegexps)
059d995d5added webPageStart and webPageTitle as package-level regexp.MustCompile, which TestNoEagerPackageRegexps refuses: every package regexp goes through lazyre so start-up doesn't compile them. CI at61a04f42awas red on ubuntu and macOS for it. Run (Windows box, win-run; mote is out of disk and refuses ssh): - go test -run TestNoEagerPackageRegexps . : ok (red on CI before) - go test -run 'TestFailSaysAProxyPage|WebPage' -v ./internal/gui: TestFailSaysAProxyPageByItsTitle, TestWebPageHandlerEveryWhere pass - go vet ./internal/gui, gofmt -l: clean
This commit is contained in:
@@ -2,13 +2,14 @@ package gui
|
||||
|
||||
import (
|
||||
"html"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/yetone/magpie/internal/lazyre"
|
||||
)
|
||||
|
||||
var (
|
||||
webPageStart = regexp.MustCompile(`(?i)<(!doctype|html|head|body)\b`)
|
||||
webPageTitle = regexp.MustCompile(`(?is)<title[^>]*>(.*?)</title>`)
|
||||
webPageStart = lazyre.New(`(?i)<(!doctype|html|head|body)\b`)
|
||||
webPageTitle = lazyre.New(`(?is)<title[^>]*>(.*?)</title>`)
|
||||
)
|
||||
|
||||
// webPageSaid is a proxy's own web page inside an error text of magpie's:
|
||||
|
||||
Reference in New Issue
Block a user