forked from TrueCloudLab/distribution
reference: introduce const for "localhost"
Localhost is treated special when parsing references, and always considered to be a domain, despite not having a "." nor a ":port". Adding a const for this, to allow documenting this special case (making it more visible). Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
bbd41f40bb
commit
a4cec8ca82
2 changed files with 5 additions and 1 deletions
|
@ -125,7 +125,7 @@ func ParseDockerRef(ref string) (Named, error) {
|
|||
// needs to be already validated before.
|
||||
func splitDockerDomain(name string) (domain, remainder string) {
|
||||
i := strings.IndexRune(name, '/')
|
||||
if i == -1 || (!strings.ContainsAny(name[:i], ".:") && name[:i] != "localhost" && strings.ToLower(name[:i]) == name[:i]) {
|
||||
if i == -1 || (!strings.ContainsAny(name[:i], ".:") && name[:i] != localhost && strings.ToLower(name[:i]) == name[:i]) {
|
||||
domain, remainder = defaultDomain, name
|
||||
} else {
|
||||
domain, remainder = name[:i], name[i+1:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue