From 3b4d6de6ff91fcedd67ce21b0634b4bee78c892c Mon Sep 17 00:00:00 2001 From: izumin5210 Date: Tue, 8 May 2018 18:08:28 +0900 Subject: [PATCH] Stop redundantly initialization --- docker/util.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docker/util.go b/docker/util.go index 6566f15..a489c79 100644 --- a/docker/util.go +++ b/docker/util.go @@ -9,15 +9,17 @@ import ( ) func init() { - if !doesAllowDashAndUnderscore() { + if doesAllowDashAndUnderscore() { + // https://github.com/docker/compose/blob/1.21.0/compose/cli/command.py#L132 + projectNormalizePattern = regexp.MustCompile(`[^-_a-z0-9]`) + } else { // https://github.com/docker/compose/blob/f55c9d42013e8fbb5285bc402d8248a846485217/compose/cli/command.py#L105 projectNormalizePattern = regexp.MustCompile(`[^a-z0-9]`) } } var ( - // https://github.com/docker/compose/blob/1.21.0/compose/cli/command.py#L132 - projectNormalizePattern = regexp.MustCompile(`[^-_a-z0-9]`) + projectNormalizePattern *regexp.Regexp ) // NormalizeProjectName normalizes a project name