From 22b246417f52aa6bd0e358e41e2bfb9c0a59c867 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Wed, 6 Sep 2017 11:35:06 -0400 Subject: [PATCH] Move names to a more appropriate package. Signed-off-by: Daniel Nephin --- daemon/checkpoint.go | 6 +++--- daemon/names.go | 6 +++--- {api => daemon/names}/names.go | 2 +- volume/local/local.go | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) rename {api => daemon/names}/names.go (96%) diff --git a/daemon/checkpoint.go b/daemon/checkpoint.go index d3028f1e28..7bdcae5154 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/daemon/names" ) var ( - validCheckpointNameChars = api.RestrictedNameChars - validCheckpointNamePattern = api.RestrictedNamePattern + validCheckpointNameChars = names.RestrictedNameChars + validCheckpointNamePattern = names.RestrictedNamePattern ) // getCheckpointDir verifies checkpoint directory for create,remove, list options and checks if checkpoint already exists diff --git a/daemon/names.go b/daemon/names.go index e61e94008f..712df9fd0f 100644 --- a/daemon/names.go +++ b/daemon/names.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - "github.com/docker/docker/api" "github.com/docker/docker/container" + "github.com/docker/docker/daemon/names" "github.com/docker/docker/pkg/namesgenerator" "github.com/docker/docker/pkg/stringid" "github.com/pkg/errors" @@ -13,8 +13,8 @@ import ( ) var ( - validContainerNameChars = api.RestrictedNameChars - validContainerNamePattern = api.RestrictedNamePattern + validContainerNameChars = names.RestrictedNameChars + validContainerNamePattern = names.RestrictedNamePattern ) func (daemon *Daemon) registerName(container *container.Container) error { diff --git a/api/names.go b/daemon/names/names.go similarity index 96% rename from api/names.go rename to daemon/names/names.go index f147d1f4ce..26f6748a8f 100644 --- a/api/names.go +++ b/daemon/names/names.go @@ -1,4 +1,4 @@ -package api +package names import "regexp" diff --git a/volume/local/local.go b/volume/local/local.go index eb78d875a5..c85122d63a 100644 --- a/volume/local/local.go +++ b/volume/local/local.go @@ -13,7 +13,7 @@ import ( "strings" "sync" - "github.com/docker/docker/api" + "github.com/docker/docker/daemon/names" "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/pkg/mount" "github.com/docker/docker/volume" @@ -35,7 +35,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 = api.RestrictedNamePattern + volumeNameRegex = names.RestrictedNamePattern ) type activeMount struct { @@ -298,7 +298,7 @@ func (r *Root) validateName(name string) error { return validationError("volume name is too short, names should be at least two alphanumeric characters") } if !volumeNameRegex.MatchString(name) { - return validationError(fmt.Sprintf("%q includes invalid characters for a local volume name, only %q are allowed. If you intended to pass a host directory, use absolute path", name, api.RestrictedNameChars)) + return validationError(fmt.Sprintf("%q includes invalid characters for a local volume name, only %q are allowed. If you intended to pass a host directory, use absolute path", name, names.RestrictedNameChars)) } return nil }