application.New() returns a Tags instance by value hinting that the Tags type supports by-value semantics. Unfortunately this is not the case. Consider this code:
tagsa := application.New("appName", "serviceName")
tagsb := tagsa
// Oops tagsb now has the same custom tag added to tagsa
tagsa.AddCustomTagFromEnv("varName", "tag")
Solution: application.New should be deprecated. A different new function that returns a Tags instead of Tags should be created. Documentation should stress that Tags does not support by-value semantics. Or application.New could just return Tags as a breaking change.
Alternatively, Tags could be made to support by-value semantics. To do this, modifications to CustomTags field of Tags would mean creating a new map each time rather than modifying it in place.
application.New() returns a Tags instance by value hinting that the Tags type supports by-value semantics. Unfortunately this is not the case. Consider this code:
Solution: application.New should be deprecated. A different new function that returns a Tags instead of Tags should be created. Documentation should stress that Tags does not support by-value semantics. Or application.New could just return Tags as a breaking change.
Alternatively, Tags could be made to support by-value semantics. To do this, modifications to CustomTags field of Tags would mean creating a new map each time rather than modifying it in place.