struct

A Go type that groups named fields of different types into one value, such as a Target with a Name and a Port.

In more detail

Structs are how Go models data: configuration, targets, results and reports. Fields are accessed with a dot, as in t.Port, and methods can be attached to the type. A zero struct has every field at its zero value and is often ready to use.

Example

type Target struct {
	Name string
	Port int
}

Related terms

Taught in

References