Merge pull request #1064 from zabio3/using-rawstring-regex

Simplify regular expression by using raw string literal
docker-19.03
Tõnis Tiigi 2019-07-02 17:39:42 -07:00 committed by GitHub
commit 21034f4234
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -50,8 +50,8 @@ const (
keyContextSubDir = "contextsubdir"
)
var httpPrefix = regexp.MustCompile("^https?://")
var gitUrlPathWithFragmentSuffix = regexp.MustCompile("\\.git(?:#.+)?$")
var httpPrefix = regexp.MustCompile(`^https?://`)
var gitUrlPathWithFragmentSuffix = regexp.MustCompile(`\.git(?:#.+)?$`)
func Build(ctx context.Context, c client.Client) (*client.Result, error) {
opts := c.BuildOpts().Opts

View File

@ -79,7 +79,7 @@ http:
}
func detectPort(ctx context.Context, rc io.ReadCloser) (string, error) {
r := regexp.MustCompile("listening on 127\\.0\\.0\\.1:(\\d+)")
r := regexp.MustCompile(`listening on 127\.0\.0\.1:(\d+)`)
s := bufio.NewScanner(rc)
found := make(chan struct{})
defer func() {