From dba271a42ab4841dbcf2e953491e9ee728cd8e16 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Wed, 21 Dec 2016 22:42:47 +0100 Subject: [PATCH] Move names to package api Signed-off-by: Vincent Demeester --- {utils => api}/names.go | 2 +- daemon/checkpoint.go | 6 +++--- daemon/names.go | 6 +++--- volume/local/local.go | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) rename {utils => api}/names.go (96%) diff --git a/utils/names.go b/api/names.go similarity index 96% rename from utils/names.go rename to api/names.go index 632062819c..f147d1f4ce 100644 --- a/utils/names.go +++ b/api/names.go @@ -1,4 +1,4 @@ -package utils +package api import "regexp" diff --git a/daemon/checkpoint.go b/daemon/checkpoint.go index 27181743f5..b8c4b8c87b 100644 --- a/daemon/checkpoint.go +++ b/daemon/checkpoint.go @@ -7,13 +7,13 @@ import ( "os" "path/filepath" + "github.com/docker/docker/api" "github.com/docker/docker/api/types" - "github.com/docker/docker/utils" ) var ( - validCheckpointNameChars = utils.RestrictedNameChars - validCheckpointNamePattern = utils.RestrictedNamePattern + validCheckpointNameChars = api.RestrictedNameChars + validCheckpointNamePattern = api.RestrictedNamePattern ) // CheckpointCreate checkpoints the process running in a container with CRIU diff --git a/daemon/names.go b/daemon/names.go index 273d551513..613d45e365 100644 --- a/daemon/names.go +++ b/daemon/names.go @@ -5,16 +5,16 @@ import ( "strings" "github.com/Sirupsen/logrus" + "github.com/docker/docker/api" "github.com/docker/docker/container" "github.com/docker/docker/pkg/namesgenerator" "github.com/docker/docker/pkg/registrar" "github.com/docker/docker/pkg/stringid" - "github.com/docker/docker/utils" ) var ( - validContainerNameChars = utils.RestrictedNameChars - validContainerNamePattern = utils.RestrictedNamePattern + validContainerNameChars = api.RestrictedNameChars + validContainerNamePattern = api.RestrictedNamePattern ) func (daemon *Daemon) registerName(container *container.Container) error { diff --git a/volume/local/local.go b/volume/local/local.go index 62c45e69ea..e32c5c124d 100644 --- a/volume/local/local.go +++ b/volume/local/local.go @@ -16,9 +16,9 @@ import ( "github.com/pkg/errors" "github.com/Sirupsen/logrus" + "github.com/docker/docker/api" "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/mount" - "github.com/docker/docker/utils" "github.com/docker/docker/volume" ) @@ -36,7 +36,7 @@ var ( // volumeNameRegex ensures the name assigned for the volume is valid. // This name is used to create the bind directory, so we need to avoid characters that // would make the path to escape the root directory. - volumeNameRegex = utils.RestrictedNamePattern + volumeNameRegex = api.RestrictedNamePattern ) type validationError struct { @@ -269,7 +269,7 @@ func (r *Root) validateName(name string) error { return validationError{fmt.Errorf("volume name is too short, names should be at least two alphanumeric characters")} } if !volumeNameRegex.MatchString(name) { - 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)} + 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)} } return nil }