Directories ¶
Path | Synopsis |
---|---|
arrays
|
|
example1
Sample program to show how to declare and iterate over arrays of different types.
|
Sample program to show how to declare and iterate over arrays of different types. |
example2
Sample program to show how arrays of different sizes are not of the same type.
|
Sample program to show how arrays of different sizes are not of the same type. |
example3
Sample program to show how the behavior of the for range and how memory for an array is contiguous.
|
Sample program to show how the behavior of the for range and how memory for an array is contiguous. |
exercises/exercise1
Declare an array of 5 strings with each element initialized to its zero value.
|
Declare an array of 5 strings with each element initialized to its zero value. |
exercises/template1
Declare an array of 5 strings with each element initialized to its zero value.
|
Declare an array of 5 strings with each element initialized to its zero value. |
constants
|
|
example1
Sample program to show how to declare constants and their implementation in Go.
|
Sample program to show how to declare constants and their implementation in Go. |
example2
Sample program to show how constants do have a parallel type system.
|
Sample program to show how constants do have a parallel type system. |
example3
Sample program to show how iota works.
|
Sample program to show how iota works. |
exercises/exercise1
Declare an untyped and typed constant and display their values.
|
Declare an untyped and typed constant and display their values. |
exercises/template1
Declare an untyped and typed constant and display their values.
|
Declare an untyped and typed constant and display their values. |
embedding
|
|
example1
Sample program to show how what we are doing is NOT embedding a type but just using a type as a field.
|
Sample program to show how what we are doing is NOT embedding a type but just using a type as a field. |
example2
Sample program to show how to embed a type into another type and the relationship between the inner and outer type.
|
Sample program to show how to embed a type into another type and the relationship between the inner and outer type. |
example3
Sample program to show how embedded types work with interfaces.
|
Sample program to show how embedded types work with interfaces. |
example4
Sample program to show what happens when the outer and inner type implement the same interface.
|
Sample program to show what happens when the outer and inner type implement the same interface. |
exercises/exercise1
Copy the code from the template.
|
Copy the code from the template. |
exercises/template1
Copy the code from the template.
|
Copy the code from the template. |
exporting
|
|
example1
Sample program to show how to access an exported identifier.
|
Sample program to show how to access an exported identifier. |
example1/counters
Package counters provides alert counter support.
|
Package counters provides alert counter support. |
example2
Sample program to show how the program can't access an unexported identifier from another package.
|
Sample program to show how the program can't access an unexported identifier from another package. |
example2/counters
Package counters provides alert counter support.
|
Package counters provides alert counter support. |
example3
Sample program to show how the program can access a value of an unexported identifier from another package.
|
Sample program to show how the program can access a value of an unexported identifier from another package. |
example3/counters
Package counters provides alert counter support.
|
Package counters provides alert counter support. |
example4
Sample program to show how unexported fields from an exported struct type can't be accessed directly.
|
Sample program to show how unexported fields from an exported struct type can't be accessed directly. |
example4/users
Package users provides support for user management.
|
Package users provides support for user management. |
example5
Sample program to show how to create values from exported types with embedded unexported types.
|
Sample program to show how to create values from exported types with embedded unexported types. |
example5/users
Package users provides support for user management.
|
Package users provides support for user management. |
exercises/exercise1
Create a package named toy with a single exported struct type named Toy.
|
Create a package named toy with a single exported struct type named Toy. |
exercises/exercise1/toy
Package toy contains support for managing toy inventory.
|
Package toy contains support for managing toy inventory. |
exercises/template1
Create a package named toy with a single exported struct type named Toy.
|
Create a package named toy with a single exported struct type named Toy. |
exercises/template1/toy
Package toy contains support for managing toy inventory.
|
Package toy contains support for managing toy inventory. |
functions
|
|
advanced/example1
Sample program to show how to recover from panics.
|
Sample program to show how to recover from panics. |
example1
Sample program to show how functions can return multiple values while using named and struct types.
|
Sample program to show how functions can return multiple values while using named and struct types. |
example2
Sample program to show how we can use the blank identifier to ignore return values.
|
Sample program to show how we can use the blank identifier to ignore return values. |
example3
Sample program to show some of the mechanics behind the short variable declaration operator redeclares.
|
Sample program to show some of the mechanics behind the short variable declaration operator redeclares. |
example4
Sample program to show how anonymous functions and closures work.
|
Sample program to show how anonymous functions and closures work. |
exercises/exercise1
Declare a struct type to maintain information about a user.
|
Declare a struct type to maintain information about a user. |
exercises/template1
Declare a struct type to maintain information about a user.
|
Declare a struct type to maintain information about a user. |
interfaces
|
|
advanced/example1
Sample program that explores how interface assignments work when values are stored inside the interface.
|
Sample program that explores how interface assignments work when values are stored inside the interface. |
example1
Sample program to show how polymorphic behavior with interfaces.
|
Sample program to show how polymorphic behavior with interfaces. |
example2
Sample program to show how to understand method sets.
|
Sample program to show how to understand method sets. |
example3
Sample program to show how you can't always get the address of a value.
|
Sample program to show how you can't always get the address of a value. |
example4
Sample program to show how method sets can affect behavior.
|
Sample program to show how method sets can affect behavior. |
example5
Sample program to show how the concrete value assigned to the interface is what is stored inside the interface.
|
Sample program to show how the concrete value assigned to the interface is what is stored inside the interface. |
exercises/exercise1
Declare an interface named speaker with a method named speak.
|
Declare an interface named speaker with a method named speak. |
exercises/template1
Declare an interface named speaker with a method named speak.
|
Declare an interface named speaker with a method named speak. |
maps
|
|
example1
Sample program to show how to declare, initialize and iterate over a map.
|
Sample program to show how to declare, initialize and iterate over a map. |
example2
Sample program to show how to declare and initialize a map using a map literal and delete a key.
|
Sample program to show how to declare and initialize a map using a map literal and delete a key. |
example3
Sample program to show how only types that can have equality defined on them can be a map key.
|
Sample program to show how only types that can have equality defined on them can be a map key. |
exercises/exercise1
Declare and make a map of integer values with a string as the key.
|
Declare and make a map of integer values with a string as the key. |
exercises/template1
Declare and make a map of integer values with a string as the key.
|
Declare and make a map of integer values with a string as the key. |
methods
|
|
example1
Sample program to show how to declare methods and how the Go compiler supports them.
|
Sample program to show how to declare methods and how the Go compiler supports them. |
example2
Sample program to show how to declare methods against a named type.
|
Sample program to show how to declare methods against a named type. |
example3
Sample program to show how to declare function variables.
|
Sample program to show how to declare function variables. |
example4
Sample program to show how to declare and use function types.
|
Sample program to show how to declare and use function types. |
exercises/exercise1
Declare a struct that represents a baseball player.
|
Declare a struct that represents a baseball player. |
exercises/template1
Declare a struct that represents a baseball player.
|
Declare a struct that represents a baseball player. |
pointers
|
|
example1
Sample program to show the basic concept of pass by value.
|
Sample program to show the basic concept of pass by value. |
example2
Sample program to show the basic concept of using a pointer to share data.
|
Sample program to show the basic concept of using a pointer to share data. |
example3
Sample program to show the basic concept of using a pointer to share data.
|
Sample program to show the basic concept of using a pointer to share data. |
example4
Sample program to show variables stay on or escape from the stack.
|
Sample program to show variables stay on or escape from the stack. |
example5
Sample program to show how stacks grow/change.
|
Sample program to show how stacks grow/change. |
exercises/exercise1
Declare and initialize a variable of type int with the value of 20.
|
Declare and initialize a variable of type int with the value of 20. |
exercises/exercise2
Declare a struct type and create a value of this type.
|
Declare a struct type and create a value of this type. |
exercises/template1
Declare and initialize a variable of type int with the value of 20.
|
Declare and initialize a variable of type int with the value of 20. |
exercises/template2
Declare a struct type and create a value of this type.
|
Declare a struct type and create a value of this type. |
receiver_choices
|
|
exercises/exercise1
Declare a struct type named Point with two fields, X and Y of type int.
|
Declare a struct type named Point with two fields, X and Y of type int. |
exercises/template1
Declare a struct type named Point with two fields, X and Y of type int.
|
Declare a struct type named Point with two fields, X and Y of type int. |
slices
|
|
advanced/example1
Sample program to show how to use a third index slice.
|
Sample program to show how to use a third index slice. |
example1
Sample program to show how the capacity of the slice is not available for use.
|
Sample program to show how the capacity of the slice is not available for use. |
example2
Sample program to show the components of a slice.
|
Sample program to show the components of a slice. |
example3
Sample program to show how to takes slices of slices to create different views of and make changes to the underlying array.
|
Sample program to show how to takes slices of slices to create different views of and make changes to the underlying array. |
example4
Sample program to show how to grow a slice using the built-in function append and how append grows the capacity of the underlying array.
|
Sample program to show how to grow a slice using the built-in function append and how append grows the capacity of the underlying array. |
example5
Sample program to show how one needs to be careful when appending to a slice when you have a reference to an element.
|
Sample program to show how one needs to be careful when appending to a slice when you have a reference to an element. |
example6
Sample program to show how strings have a UTF-8 encoded byte array.
|
Sample program to show how strings have a UTF-8 encoded byte array. |
example7
Sample program to show how to declare and use variadic functions.
|
Sample program to show how to declare and use variadic functions. |
exercises/exercise1
Declare a nil slice of integers.
|
Declare a nil slice of integers. |
exercises/template1
Declare a nil slice of integers.
|
Declare a nil slice of integers. |
struct_types
|
|
advanced/example1
Sample program to show how struct types align on boundaries.
|
Sample program to show how struct types align on boundaries. |
example1
Sample program to show how to declare and initialize struct types.
|
Sample program to show how to declare and initialize struct types. |
example2
Sample program to show how to declare and initialize anonymous struct types.
|
Sample program to show how to declare and initialize anonymous struct types. |
example3
Sample program to show how variables of an unnamed type can be assigned to variables of a named type, when they are identical.
|
Sample program to show how variables of an unnamed type can be assigned to variables of a named type, when they are identical. |
exercises/exercise1
Declare a struct type to maintain information about a user (name, email and age).
|
Declare a struct type to maintain information about a user (name, email and age). |
exercises/template1
Declare a struct type to maintain information about a user (name, email and age).
|
Declare a struct type to maintain information about a user (name, email and age). |
type_conversions
|
|
example1
Sample program to show how to declare and use a named type.
|
Sample program to show how to declare and use a named type. |
example2
Sample program to show a idiomatic use of named types from the standard library and how they work in concert with other Go concepts.
|
Sample program to show a idiomatic use of named types from the standard library and how they work in concert with other Go concepts. |
example3
Sample program to show a idiomatic use of named types from the standard library and how they work in concert with other Go concepts.
|
Sample program to show a idiomatic use of named types from the standard library and how they work in concert with other Go concepts. |
example4
Sample program to show a idiomatic use of named types from the standard library and how they work in concert with other Go concepts.
|
Sample program to show a idiomatic use of named types from the standard library and how they work in concert with other Go concepts. |
exercises/exercise1
Declare a named type called counter with a base type of int.
|
Declare a named type called counter with a base type of int. |
exercises/template1
Declare a named type called counter with a base type of int.
|
Declare a named type called counter with a base type of int. |
variables
|
|
example1
Sample program to show how to declare variables.
|
Sample program to show how to declare variables. |
exercises/exercise1
Declare three variables that are initialized to their zero value and three declared with a literal value.
|
Declare three variables that are initialized to their zero value and three declared with a literal value. |
exercises/template1
Declare three variables that are initialized to their zero value and three declared with a literal value.
|
Declare three variables that are initialized to their zero value and three declared with a literal value. |
Click to show internal directories.
Click to hide internal directories.