mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
52f4d09ffb
Signed-off-by: John Howard <jhoward@microsoft.com>
16 lines
293 B
Go
16 lines
293 B
Go
package image
|
|
|
|
import (
|
|
"fmt"
|
|
"regexp"
|
|
)
|
|
|
|
var validHex = regexp.MustCompile(`^([a-f0-9]{64})$`)
|
|
|
|
// Check wheather id is a valid image ID or not
|
|
func ValidateID(id string) error {
|
|
if ok := validHex.MatchString(id); !ok {
|
|
return fmt.Errorf("image ID '%s' is invalid", id)
|
|
}
|
|
return nil
|
|
}
|