Curriculum Types & methods Structs exercise 1 · mcq
Structs
Translate the TypeScript record User into the idiomatic Go
struct declaration. Go's struct is a typed bag of fields —
similar in spirit to a TS interface or type alias, but with
its own keyword family (type Foo struct { ... }) that you
don't get to skip.
TypeScript reference
About this theme
type Foo struct { ... }. A struct is a typed record — fields and their types, nothing else. No methods on the struct itself (those come next). Field access with .. Struct literals can be positional or named; named is the only sane choice for anything with more than two fields.