Go Structs

From NovaOrdis Knowledge Base
Revision as of 01:58, 30 March 2016 by Ovidiu (talk | contribs)
Jump to navigation Jump to search

Internal

Overview

A struct is a user-defined type that contains named fields. It is introduced by the type keyword, to indicated that this is a user-defined type, followed by the type name and the keyword struct.

type myStruct struct {
    i int
    s string
}

Are all users can define (in terms of types) structs, or there are other user-defined types?

Struct Literals

Fields

A field is always exported by the package it is enclosed in.