Skip to content

Commit 187e703

Browse files
committed
Return an error for duplicated tags in a single entry as well
1 parent a65f578 commit 187e703

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

manifest/rfc2822.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,15 @@ func (manifest *Manifest2822) AddEntry(entry Manifest2822Entry) error {
171171
return fmt.Errorf("Tags %q has invalid Maintainers: %q (expected format %q)", strings.Join(invalidMaintainers, ", "), MaintainersFormat)
172172
}
173173

174+
seenTag := map[string]bool{}
174175
for _, tag := range entry.Tags {
175176
if otherEntry := manifest.GetTag(tag); otherEntry != nil {
176177
return fmt.Errorf("Tags %q includes duplicate tag: %q (duplicated in %q)", entry.TagsString(), tag, otherEntry.TagsString())
177178
}
179+
if seenTag[tag] {
180+
return fmt.Errorf("Tags %q includes duplicate tag: %q", entry.TagsString(), tag)
181+
}
182+
seenTag[tag] = true
178183
}
179184

180185
for i, existingEntry := range manifest.Entries {

0 commit comments

Comments
 (0)