structs

Guided tour · Misc · pkg.go.dev →

Marker types you embed in your own structs to opt into special behavior. Currently just HostLayout (Go 1.23+).

HostLayout

Tell the compiler a struct matches the host platform's C layout — needed for syscall/cgo interop, not everyday code.

Opt-in host layout

type timespec struct {
    _ structs.HostLayout
    Sec  int64
    Nsec int64
}