using raw string literal

regular expressions have their own escape sequences, raw strings can improve their readability.
Signed-off-by: Tomohiro Kusumoto <zabio1192@gmail.com>
docker-19.03
zabio3 2019-06-30 12:24:25 +09:00
parent a61393a5bc
commit be2691d06c
2 changed files with 3 additions and 3 deletions

View File

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

View File

@ -79,7 +79,7 @@ http:
} }
func detectPort(ctx context.Context, rc io.ReadCloser) (string, error) { 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) s := bufio.NewScanner(rc)
found := make(chan struct{}) found := make(chan struct{})
defer func() { defer func() {