diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go index 2c29a3e6018f77..9d6d038dab1213 100644 --- a/src/go/build/deps_test.go +++ b/src/go/build/deps_test.go @@ -192,10 +192,11 @@ var pkgDeps = map[string][]string{ "runtime/trace": {"L0", "context", "fmt"}, "text/tabwriter": {"L2"}, - "testing": {"L2", "flag", "fmt", "internal/race", "os", "runtime/debug", "runtime/pprof", "runtime/trace", "time"}, - "testing/iotest": {"L2", "log"}, - "testing/quick": {"L2", "flag", "fmt", "reflect", "time"}, - "internal/testenv": {"L2", "OS", "flag", "testing", "syscall"}, + "testing": {"L2", "flag", "fmt", "internal/race", "os", "runtime/debug", "runtime/pprof", "runtime/trace", "time"}, + "testing/iotest": {"L2", "log"}, + "testing/quick": {"L2", "flag", "fmt", "reflect", "time"}, + "internal/testenv": {"L2", "OS", "flag", "testing", "syscall"}, + "internal/lazyregexp": {"L2", "OS", "regexp"}, // L4 is defined as L3+fmt+log+time, because in general once // you're using L3 packages, use of fmt, log, or time is not a big deal. @@ -208,7 +209,7 @@ var pkgDeps = map[string][]string{ // Go parser. "go/ast": {"L4", "OS", "go/scanner", "go/token"}, - "go/doc": {"L4", "OS", "go/ast", "go/token", "regexp", "text/template"}, + "go/doc": {"L4", "OS", "go/ast", "go/token", "regexp", "internal/lazyregexp", "text/template"}, "go/parser": {"L4", "OS", "go/ast", "go/scanner", "go/token"}, "go/printer": {"L4", "OS", "go/ast", "go/scanner", "go/token", "text/tabwriter"}, "go/scanner": {"L4", "OS", "go/token"}, diff --git a/src/go/doc/comment.go b/src/go/doc/comment.go index 73857330fa7158..31ee93e44f819e 100644 --- a/src/go/doc/comment.go +++ b/src/go/doc/comment.go @@ -8,6 +8,7 @@ package doc import ( "bytes" + "internal/lazyregexp" "io" "strings" "text/template" // for HTMLEscape @@ -69,7 +70,7 @@ const ( urlRx = protoPart + `://` + hostPart + pathPart ) -var matchRx = newLazyRE(`(` + urlRx + `)|(` + identRx + `)`) +var matchRx = lazyregexp.New(`(` + urlRx + `)|(` + identRx + `)`) var ( html_a = []byte(` 0 && strings.HasSuffix(strings.TrimSuffix(os.Args[0], ".exe"), ".test") -func newLazyRE(str string) *lazyRE { - lr := &lazyRE{str: str} +func New(str string) *Regexp { + lr := &Regexp{str: str} if inTest { // In tests, always compile the regexps early. lr.re()