mirror of
https://github.com/moby/moby.git
synced 2026-08-02 22:26:52 +00:00
pkg/idtools: use lazyregexp to compile regexes on first use
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -3,11 +3,12 @@ package idtools // import "github.com/docker/docker/pkg/idtools"
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/docker/docker/internal/lazyregexp"
|
||||
)
|
||||
|
||||
// add a user and/or group to Linux /etc/passwd, /etc/group using standard
|
||||
@@ -18,7 +19,7 @@ import (
|
||||
var (
|
||||
once sync.Once
|
||||
userCommand string
|
||||
idOutRegexp = regexp.MustCompile(`uid=([0-9]+).*gid=([0-9]+)`)
|
||||
idOutRegexp = lazyregexp.New(`uid=([0-9]+).*gid=([0-9]+)`)
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user