Perhaps the most similar mechanism is Struct tags. Not the most elegant, but they can be evaluated at runtime and provide metadata for members of the structure.
From reflection package documentation: enter StructTag
They are used, for example, in JSON and XML encoding for user element names.
, json, , , JSON, , , , - , . , :
type Foo struct {
Bar string `json:"-"`
Baz string `json:",omitempty"`
Gaz string `json:"fuzz"`
}
API REST, .
" : ", Get StructTag , example.