Details
-
Improvement
-
Resolution: Works as Designed
-
Unknown
-
None
-
None
-
None
-
None
Description
The NewTagSetFromMap and NewTagSetsFromMaps functions may mislead users into expecting that the ordered tag.Set type can be created from a Go map, when in fact the resulting tag.Set has a non-deterministic order. Deprecate those functions in preparation for them to be removed with v2.0.
Note that users can safely define ordered tag sets using a syntax like
set := tag.Set{{Name: "name", Value: "value"}, ...}
|
However, that's a bit verbose for longer tag sets, so we should consider adding a convenience function that takes in a list of tag tuples and creates a Set, returning an error if the list length is odd.
func ToSet(tags ...string) (Set, error)
|
Since that requires users to handle errors, and we typically expect users to define this statically in code, we should also consider adding a shorter convenience function that panics on any errors (inspired by Go's template.Must).
func Must(Set, error) Set
|
Definition of done:
- Deprecate NewTagSetFromMap and NewTagSetsFromMaps
- Consider adding convenience functions for creating a Set