mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
image: precompile regexp
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
This commit is contained in:
parent
1b678f86b3
commit
8f57e7d2ef
1 changed files with 2 additions and 1 deletions
|
@ -19,6 +19,8 @@ import (
|
|||
// For more information see: http://sourceforge.net/p/aufs/aufs3-standalone/ci/aufs3.12/tree/config.mk
|
||||
const MaxImageDepth = 127
|
||||
|
||||
var validHex = regexp.MustCompile(`^([a-f0-9]{64})$`)
|
||||
|
||||
type Image struct {
|
||||
ID string `json:"id"`
|
||||
Parent string `json:"parent,omitempty"`
|
||||
|
@ -266,7 +268,6 @@ func NewImgJSON(src []byte) (*Image, error) {
|
|||
|
||||
// Check wheather id is a valid image ID or not
|
||||
func ValidateID(id string) error {
|
||||
validHex := regexp.MustCompile(`^([a-f0-9]{64})$`)
|
||||
if ok := validHex.MatchString(id); !ok {
|
||||
return fmt.Errorf("image ID '%s' is invalid", id)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue