MCPcopy
hub / github.com/redspread/spread / FromString

Function FromString

pkg/image/image.go:86–102  ·  view source on GitHub ↗

FromString creates an Image using a string representation

(str string)

Source from the content-addressed store, hash-verified

84
85// FromString creates an Image using a string representation
86func FromString(str string) (*Image, error) {
87 named, err := reference.ParseNamed(str)
88 if err != nil {
89 return nil, err
90 }
91
92 // check for tag
93 hasTag := !isNameOnly(named)
94
95 // implicit default tag
96 tagged := withDefaultTag(named)
97
98 return &Image{
99 image: tagged.(reference.NamedTagged),
100 tag: hasTag,
101 }, nil
102}
103
104// Implementations below from docker/docker upstream
105// TODO: once kubernetes updates Docker version these should be removed and use "github.com/docker/docker/reference"

Callers 7

TestParseNameFunction · 0.85
TestParseTagFunction · 0.85
TestParseUserNameFunction · 0.85
TestParseUserTagFunction · 0.85
TestParseRegistryUserTagFunction · 0.85
TestParseInvalidImageFunction · 0.85

Calls 2

isNameOnlyFunction · 0.85
withDefaultTagFunction · 0.85

Tested by 7

TestParseNameFunction · 0.68
TestParseTagFunction · 0.68
TestParseUserNameFunction · 0.68
TestParseUserTagFunction · 0.68
TestParseRegistryUserTagFunction · 0.68
TestParseInvalidImageFunction · 0.68