pkg/stringid: remove unused ValidateID() function
This format-check was only used for v1 images. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
2004c507ab
commit
6f719acd23
2 changed files with 1 additions and 25 deletions
|
@ -4,7 +4,6 @@ package stringid // import "github.com/docker/docker/pkg/stringid"
|
|||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -15,10 +14,7 @@ const (
|
|||
fullLen = 64
|
||||
)
|
||||
|
||||
var (
|
||||
validShortID = regexp.MustCompile("^[a-f0-9]{12}$")
|
||||
validHex = regexp.MustCompile(`^[a-f0-9]{64}$`)
|
||||
)
|
||||
var validShortID = regexp.MustCompile("^[a-f0-9]{12}$")
|
||||
|
||||
// IsShortID determines if id has the correct format and length for a short ID.
|
||||
// It checks the IDs length and if it consists of valid characters for IDs (a-f0-9).
|
||||
|
@ -60,14 +56,3 @@ func GenerateRandomID() string {
|
|||
return id
|
||||
}
|
||||
}
|
||||
|
||||
// ValidateID checks whether an ID string is a valid, full-length image ID.
|
||||
func ValidateID(id string) error {
|
||||
if len(id) != fullLen {
|
||||
return errors.New("image ID '" + id + "' is invalid")
|
||||
}
|
||||
if !validHex.MatchString(id) {
|
||||
return errors.New("image ID '" + id + "' is invalid")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -78,12 +78,3 @@ func BenchmarkIsShortID(b *testing.B) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkValidateID(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
for _, id := range testIDs {
|
||||
_ = ValidateID(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue