if tagValues[lcVal] != "" {
return fmt.Errorf("duplicate tag value %q for tag %q", val, key)
}
+ // Checks for collisions between labels from different values.
tagValues[lcVal] = val
for _, tagLbl := range v.Tags[key].Values[val].Labels {
label := strings.ToLower(tagLbl.Label)
- if tagValues[label] != "" {
- return fmt.Errorf("tag value label %q for pair (%q:%q) already seen as a value key or label", tagLbl.Label, key, val)
+ if tagValues[label] != "" && tagValues[label] != val {
+ return fmt.Errorf("tag value label %q for pair (%q:%q) already seen on value %q", tagLbl.Label, key, val, tagValues[label])
}
- tagValues[label] = tagLbl.Label
+ tagValues[label] = val
}
}
}
return err
}
default:
- return fmt.Errorf("tag value of type %T for key %q is not a valid", singleVal, key)
+ return fmt.Errorf("value list element type for tag key %q was %T, but expected a string", key, singleVal)
}
}
default:
- return fmt.Errorf("tag value of type %T for key %q is not a valid", val, key)
+ return fmt.Errorf("value type for tag key %q was %T, but expected a string or list of strings", key, val)
}
}
return nil