Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

The application/Tags type acts like it supports by value semantics but really it doesn't #183

@keep94

Description

@keep94

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions