3 ms·
The reflect package specifies a "convention" which it uses to extract key-value pairs from a struct tag using the Get method: https://golang.org/pkg/reflect/#S
by cypher543 11y ago
The reflect package specifies a "convention" which it uses to extract key-value pairs from a struct tag using the Get method:
https://golang.org/pkg/reflect/#StructTag https://golang.org/pkg/reflect/#StructTag
There's no need to parse the entire tag string yourself and it's safe to assume other libraries will work with the convention. If they don't, that's not your fault and it would break with other tags like "json" and "xml" anyway.