Go Structs: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 1: Line 1:
=Internal=
=Internal=


* [[Go Concepts - The Type System|The Type System]]
* [[Go_Concepts_-_The_Type_System#Structs|The Type System]]


=Overview=
=Overview=

Revision as of 01:56, 30 March 2016

Internal

Overview

A struct is a user-defined type that contains named fields.

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.