Skip to content

Commit

Permalink
Stop redundantly initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
izumin5210 committed May 8, 2018
1 parent ee38cf9 commit 3b4d6de
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docker/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3b4d6de

Please sign in to comment.