Introducing Tag
December 11, 2025 · 3 min read
CT
Codnect Team
Project notes and engineering updates
We are happy to introduce Tag, a declarative struct tag parser for Go.

Introducing Tag
CodnectWe created Tag to make custom struct tag formats easier to parse, type, and maintain without repeating string-splitting logic in every package.
Tag focuses on a small set of ideas:
- Describe tag syntax with ordinary Go structs.
- Parse primary values, boolean flags, and key-value options consistently.
- Bind parsed values into typed fields instead of raw strings.
- Support practical value shapes such as primitives, slices, maps, and nested structs.
- Keep the public API small enough to understand quickly.
Why Tag?
Go’s reflect.StructTag gives you strings. That is flexible, but packages often
need typed values, default options, flags, and nested values after parsing.
Tag lets you define that shape declaratively:
type PropTag struct {
Key string `option:"value"`
Optional bool `option:"optional"`
Default int `option:"default"`
}
func (PropTag) Tag() string {
return "prop"
}Then parse into the schema:
prop := &PropTag{}
err := tag.Parse(`prop:"'database.host',optional,default=5432"`, prop)Tag v1.0.0 is the first stable release.
Read the docs at go.codnect.io/tag.