Skip to content

Commit dba271a

Browse files
committed
Move names to package api
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 7164b66 commit dba271a

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

utils/names.go renamed to api/names.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package utils
1+
package api
22

33
import "regexp"
44

daemon/checkpoint.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import (
77
"os"
88
"path/filepath"
99

10+
"github.com/docker/docker/api"
1011
"github.com/docker/docker/api/types"
11-
"github.com/docker/docker/utils"
1212
)
1313

1414
var (
15-
validCheckpointNameChars = utils.RestrictedNameChars
16-
validCheckpointNamePattern = utils.RestrictedNamePattern
15+
validCheckpointNameChars = api.RestrictedNameChars
16+
validCheckpointNamePattern = api.RestrictedNamePattern
1717
)
1818

1919
// CheckpointCreate checkpoints the process running in a container with CRIU

daemon/names.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import (
55
"strings"
66

77
"github.com/Sirupsen/logrus"
8+
"github.com/docker/docker/api"
89
"github.com/docker/docker/container"
910
"github.com/docker/docker/pkg/namesgenerator"
1011
"github.com/docker/docker/pkg/registrar"
1112
"github.com/docker/docker/pkg/stringid"
12-
"github.com/docker/docker/utils"
1313
)
1414

1515
var (
16-
validContainerNameChars = utils.RestrictedNameChars
17-
validContainerNamePattern = utils.RestrictedNamePattern
16+
validContainerNameChars = api.RestrictedNameChars
17+
validContainerNamePattern = api.RestrictedNamePattern
1818
)
1919

2020
func (daemon *Daemon) registerName(container *container.Container) error {

volume/local/local.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import (
1616
"github.com/pkg/errors"
1717

1818
"github.com/Sirupsen/logrus"
19+
"github.com/docker/docker/api"
1920
"github.com/docker/docker/pkg/idtools"
2021
"github.com/docker/docker/pkg/mount"
21-
"github.com/docker/docker/utils"
2222
"github.com/docker/docker/volume"
2323
)
2424

@@ -36,7 +36,7 @@ var (
3636
// volumeNameRegex ensures the name assigned for the volume is valid.
3737
// This name is used to create the bind directory, so we need to avoid characters that
3838
// would make the path to escape the root directory.
39-
volumeNameRegex = utils.RestrictedNamePattern
39+
volumeNameRegex = api.RestrictedNamePattern
4040
)
4141

4242
type validationError struct {
@@ -269,7 +269,7 @@ func (r *Root) validateName(name string) error {
269269
return validationError{fmt.Errorf("volume name is too short, names should be at least two alphanumeric characters")}
270270
}
271271
if !volumeNameRegex.MatchString(name) {
272-
return validationError{fmt.Errorf("%q includes invalid characters for a local volume name, only %q are allowed. If you intented to pass a host directory, use absolute path", name, utils.RestrictedNameChars)}
272+
return validationError{fmt.Errorf("%q includes invalid characters for a local volume name, only %q are allowed. If you intented to pass a host directory, use absolute path", name, api.RestrictedNameChars)}
273273
}
274274
return nil
275275
}

0 commit comments

Comments
 (0)