Table of Contents

Go Programming Language Specification

Return to Golang Topics

Fair Use Source: https://golang.org/ref/spec

Version of Jan 14, 2020

Introduction

Notation

Source code representation

Lexical elements

Constants

Variables

Types

Method sets Boolean types Numeric types String types Array types Slice types Struct types Pointer types Function types Interface types Map types Channel types

Properties of types and values

Type identity Assignability Representability

Blocks

Declarations and scope

Label scopes Blank identifier Predeclared identifiers Exported identifiers Uniqueness of identifiers Constant declarations Iota Type declarations Variable declarations Short variable declarations Function declarations Method declarations

Expressions

Operands Qualified identifiers Composite literals Function literals Primary expressions Selectors Method expressions Method values Index expressions Slice expressions Type assertions Calls Passing arguments to … parameters Operators Arithmetic operators Comparison operators Logical operators Address operators Receive operator Conversions Constant expressions Order of evaluation

Statements

Terminating statements Empty statements Labeled statements Expression statements Send statements IncDec statements Assignments If statements Switch statements For statements Go statements Select statements Return statements Break statements Continue statements Goto statements Fallthrough statements Defer statements

Built-in functions

Close Length and capacity Allocation Making slices, maps and channels Appending to and copying slices Deletion of map elements Manipulating complex numbers Handling panics Bootstrapping

Packages

Source file organization Package clause Import declarations An example package

Program initialization and execution

The zero value Package initialization Program execution

Errors

Run-time panics

System considerations

Package unsafe Size and alignment guarantees