Skip to main content

Struct tags in Golang

· One min read

A struct tag is a special type of comment on a member of a struct. These comments can be inspected by code and runtime to provide additional functionality

Example from the DigitalOcean article, showing the example struct tag

type User struct {
Name string `example:"name"`
}