瀏覽代碼

Merge pull request #14828 from brahmaroutu/lint_graph_tags

/graph/tag fix lint errors/warnings
David Calavera 10 年之前
父節點
當前提交
b1009d1fdd
共有 2 個文件被更改,包括 7 次插入6 次删除
  1. 5 5
      graph/tags/tags.go
  2. 2 1
      hack/make/validate-lint

+ 5 - 5
graph/tags/tags.go

@@ -6,12 +6,10 @@ import (
 	"github.com/docker/distribution/registry/api/v2"
 )
 
-// DefaultTag is the default tag for the case where no explicit tag is
-// specified.
+// DefaultTag defines the default tag used when performing images related actions and no tag string is specified
 const DefaultTag = "latest"
 
-// ErrTagInvalidFormat is an error type used when the tag name has invalid
-// characters or is longer than allowed.
+// ErrTagInvalidFormat is returned if tag is invalid.
 type ErrTagInvalidFormat struct {
 	name string
 }
@@ -20,7 +18,9 @@ func (e ErrTagInvalidFormat) Error() string {
 	return fmt.Sprintf("Illegal tag name (%s): only [A-Za-z0-9_.-] are allowed ('.' and '-' are NOT allowed in the initial), minimum 1, maximum 128 in length", e.name)
 }
 
-// ValidateTagName validates the name of a tag
+// ValidateTagName validates the name of a tag.
+// It returns an error if the given name is an emtpy string.
+// If name does not match v2.TagNameAnchoredRegexp regexp, it returns ErrTagInvalidFormat
 func ValidateTagName(name string) error {
 	if name == "" {
 		return fmt.Errorf("tag name can't be empty")

+ 2 - 1
hack/make/validate-lint

@@ -26,6 +26,7 @@ packages=(
 	daemon/execdriver/windows
 	daemon/graphdriver/aufs
 	daemon/graphdriver/devmapper
+	daemon/graphdriver/vfs
 	daemon/graphdriver/zfs
 	daemon/logger
 	daemon/logger/fluentd
@@ -37,7 +38,7 @@ packages=(
 	docker
 	dockerinit
 	graph
-	daemon/graphdriver/vfs
+	graph/tags
 	image
 	integration-cli
 	pkg/archive