Merge pull request #1139 from aaronlehmann/reference-withtag-fix

Use correct regexp in reference.WithTag
This commit is contained in:
Richard Scothern 2015-10-29 15:25:18 -07:00
commit 326ec6c121
2 changed files with 6 additions and 1 deletions

View file

@ -213,7 +213,7 @@ func WithName(name string) (Named, error) {
// WithTag combines the name from "name" and the tag from "tag" to form a // WithTag combines the name from "name" and the tag from "tag" to form a
// reference incorporating both the name and the tag. // reference incorporating both the name and the tag.
func WithTag(name Named, tag string) (NamedTagged, error) { func WithTag(name Named, tag string) (NamedTagged, error) {
if !anchoredNameRegexp.MatchString(tag) { if !anchoredTagRegexp.MatchString(tag) {
return nil, ErrTagInvalidFormat return nil, ErrTagInvalidFormat
} }
return taggedReference{ return taggedReference{

View file

@ -417,6 +417,11 @@ func TestWithTag(t *testing.T) {
tag: "tag4", tag: "tag4",
combined: "test.com:8000/foo:tag4", combined: "test.com:8000/foo:tag4",
}, },
{
name: "test.com:8000/foo",
tag: "TAG5",
combined: "test.com:8000/foo:TAG5",
},
} }
for _, testcase := range testcases { for _, testcase := range testcases {
failf := func(format string, v ...interface{}) { failf := func(format string, v ...interface{}) {