struct field
One named value inside a struct, such as Name or Port, with its own type.
In more detail
A field name starting with a capital letter is exported and visible to other packages and to encoders such as encoding/json. Field names document the shape of your data. A pointer field can mark a setting as not given, since its zero value is nil.
Example
target.PortRelated terms
- struct — A Go type that groups named fields of different types into one value, such as a Target with a Name and a Port.
- exported identifier — A name in Go that starts with a capital letter, which makes it visible to code in other packages.
- struct tag — A string in backquotes after a struct field, such as `json:"status"`, that tells encoders like encoding/json how to name or treat that field.
Taught in
- Structs and Methods — Concurrent Systems Programming with Go