topics/

directory
v0.0.0-...-1ea3785 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2015 License: Apache-2.0

Directories

Path Synopsis
arrays
advanced/example1 command
Sample program to show how the backing array for a referene type can be placed contiguous in memory with the header value.
Sample program to show how the backing array for a referene type can be placed contiguous in memory with the header value.
example1 command
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 command
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 command
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 command
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 command
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.
benchmarking
caching
package caching provides code to show why CPU caches matter and the way the hardware caches memory affects performance.
package caching provides code to show why CPU caches matter and the way the hardware caches memory affects performance.
channels
example1 command
Sample program to show how to use an unbuffered channel to simulate a game of tennis between two goroutines.
Sample program to show how to use an unbuffered channel to simulate a game of tennis between two goroutines.
example2 command
Sample program to show how to use an unbuffered channel to simulate a relay race between four goroutines.
Sample program to show how to use an unbuffered channel to simulate a relay race between four goroutines.
example3 command
This sample program demonstrates how to use a buffered channel to receive results from other goroutines in a guaranteed way.
This sample program demonstrates how to use a buffered channel to receive results from other goroutines in a guaranteed way.
example4 command
This sample program demonstrates how to use a channel to monitor the amount of time the program is running and terminate the program if it runs too long.
This sample program demonstrates how to use a channel to monitor the amount of time the program is running and terminate the program if it runs too long.
exercises/exercise1 command
Write a program where two goroutines pass an integer back and forth ten times.
Write a program where two goroutines pass an integer back and forth ten times.
exercises/exercise2 command
Write a problem that uses a buffered channel to maintain a buffer of four strings.
Write a problem that uses a buffered channel to maintain a buffer of four strings.
exercises/template1 command
Write a program where two goroutines pass an integer back and forth ten times.
Write a program where two goroutines pass an integer back and forth ten times.
exercises/template2 command
Write a problem that uses a buffered channel to maintain a buffer of four strings.
Write a problem that uses a buffered channel to maintain a buffer of four strings.
cli
flow/example1 command
composition
example1 command
Sample program demonstrating composition through embedding.
Sample program demonstrating composition through embedding.
example2 command
Sample program demonstrating composition through embedding.
Sample program demonstrating composition through embedding.
example3 command
Sample program demonstrating when implicit interface conversions are provided by the compiler.
Sample program demonstrating when implicit interface conversions are provided by the compiler.
exercises/exercise1 command
Follow the guided comments to:
Follow the guided comments to:
exercises/template1 command
Follow the guided comments to:
Follow the guided comments to:
concurrency_patterns
chat
Package chat implements a basic chat room.
Package chat implements a basic chat room.
chat/main command
This sample program demonstrates how to create a simple chat system.
This sample program demonstrates how to create a simple chat system.
pool
Package pool manages a user defined set of resources.
Package pool manages a user defined set of resources.
pool/main command
This sample program demonstrates how to use the pool package to share a simulated set of database connections.
This sample program demonstrates how to use the pool package to share a simulated set of database connections.
task
Package task provides a pool of goroutines to perform tasks.
Package task provides a pool of goroutines to perform tasks.
task/main command
This sample program demonstrates how to use the work package to use a pool of goroutines to get work done.
This sample program demonstrates how to use the work package to use a pool of goroutines to get work done.
constants
example1 command
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 command
Sample program to show how constants do have a parallel type system.
Sample program to show how constants do have a parallel type system.
exercises/exercise1 command
Declare an untyped and typed constant and display their values.
Declare an untyped and typed constant and display their values.
exercises/template1 command
Declare an untyped and typed constant and display their values.
Declare an untyped and typed constant and display their values.
data_race
example1 command
Sample program to show how to create race conditions in our programs.
Sample program to show how to create race conditions in our programs.
example2 command
Sample program to show how to use the atomic package to provide safe access to numeric types.
Sample program to show how to use the atomic package to provide safe access to numeric types.
example3 command
Sample program to show how to use the atomic package functions Store and Load to provide safe access to numeric types.
Sample program to show how to use the atomic package functions Store and Load to provide safe access to numeric types.
example4 command
Sample program to show how to use a mutex to define critical sections of code that need synchronous access.
Sample program to show how to use a mutex to define critical sections of code that need synchronous access.
example5 command
Sample program to show how to use a read/write mutex to define critical sections of code that needs synchronous access.
Sample program to show how to use a read/write mutex to define critical sections of code that needs synchronous access.
exercises/exercise1 command
Answer for exercise 1 of Race Conditions.
Answer for exercise 1 of Race Conditions.
exercises/template1 command
Fix the race condition in this program.
Fix the race condition in this program.
embedding
example1 command
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 command
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 command
Sample program to show how embedded types work with interfaces.
Sample program to show how embedded types work with interfaces.
example4 command
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 command
Copy the code from the template.
Copy the code from the template.
exercises/template1 command
Copy the code from the template.
Copy the code from the template.
encoding
example1 command
Sample program to show how to unmarshal a JSON document into a user defined struct type.
Sample program to show how to unmarshal a JSON document into a user defined struct type.
example2 command
Sample program to show how to unmarshal a JSON document into a user defined struct type from a file.
Sample program to show how to unmarshal a JSON document into a user defined struct type from a file.
example3 command
Sample program to show how to marshal a user defined struct type into a string.
Sample program to show how to marshal a user defined struct type into a string.
example4 command
Sample program to show how write a custom Unmarshal and Marshal functions.
Sample program to show how write a custom Unmarshal and Marshal functions.
exercises/exercise1 command
Create a file with an array of JSON documents that contain a user name and email address.
Create a file with an array of JSON documents that contain a user name and email address.
exercises/template1 command
Create a file with an array of JSON documents that contain a user name and email address.
Create a file with an array of JSON documents that contain a user name and email address.
error_handling
example1 command
Sample program to show how the default error type is implemented.
Sample program to show how the default error type is implemented.
example2 command
Sample program to show how to use error variables to help the caller determine the exact error being returned.
Sample program to show how to use error variables to help the caller determine the exact error being returned.
example3 command
http://golang.org/src/pkg/encoding/json/decode.go Sample program to show how to implement a custom error type based on the json package in the standard library.
http://golang.org/src/pkg/encoding/json/decode.go Sample program to show how to implement a custom error type based on the json package in the standard library.
example4
Package example5 provides code to show how to implement behavior as context.
Package example5 provides code to show how to implement behavior as context.
example5 command
Sample program to show see if the class can find the bug.
Sample program to show see if the class can find the bug.
exercises/exercise1 command
Create two error variables, one called ErrInvalidValue and the other called ErrAmountTooLarge.
Create two error variables, one called ErrInvalidValue and the other called ErrAmountTooLarge.
exercises/exercise2 command
Create a custom error type called appError that contains three fields, err error, message string and code int.
Create a custom error type called appError that contains three fields, err error, message string and code int.
exercises/template1 command
Create two error variables, one called ErrInvalidValue and the other called ErrAmountTooLarge.
Create two error variables, one called ErrInvalidValue and the other called ErrAmountTooLarge.
exercises/template2 command
Create a custom error type called appError that contains three fields, err error, message string and code int.
Create a custom error type called appError that contains three fields, err error, message string and code int.
exporting
example1 command
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 command
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 command
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 command
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 command
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 command
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 command
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 command
Sample program to show how to trap panics that can occur from the Go runtime.
Sample program to show how to trap panics that can occur from the Go runtime.
example1 command
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 command
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 command
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.
exercises/exercise1 command
Declare a struct type to maintain information about a user.
Declare a struct type to maintain information about a user.
exercises/template1 command
Declare a struct type to maintain information about a user.
Declare a struct type to maintain information about a user.
goroutines
example1 command
Sample program to show how to create goroutines and how the scheduler behaves.
Sample program to show how to create goroutines and how the scheduler behaves.
example2 command
Sample program to show how the goroutine scheduler will time slice goroutines on a single thread.
Sample program to show how the goroutine scheduler will time slice goroutines on a single thread.
example3 command
Sample program to show how to create goroutines and how the goroutine scheduler behaves with two contexts.
Sample program to show how to create goroutines and how the goroutine scheduler behaves with two contexts.
exercises/exercise1 command
Create a program that declares two anonymous functions.
Create a program that declares two anonymous functions.
exercises/template1 command
Create a program that declares two anonymous functions.
Create a program that declares two anonymous functions.
http
api command
This program provides a sample web service that implements a RESTFul CRUD API against a MongoDB database.
This program provides a sample web service that implements a RESTFul CRUD API against a MongoDB database.
api/app
Package app provides application support for context and MongoDB access.
Package app provides application support for context and MongoDB access.
api/handlers
Package handlers contains the handler logic for processing requests.
Package handlers contains the handler logic for processing requests.
api/models
Package models contains data structures and associated behavior
Package models contains data structures and associated behavior
api/services
Package services provides business and data processing.
Package services provides business and data processing.
example1 command
Sample program to show how to implement a handler function with the http package.
Sample program to show how to implement a handler function with the http package.
example2 command
Sample program to show how you can use the FileServer handle with this service as a single call to ListenAndServe.
Sample program to show how you can use the FileServer handle with this service as a single call to ListenAndServe.
example3 command
Sample program to show how to use a ServeMux from the standard library.
Sample program to show how to use a ServeMux from the standard library.
interfaces
example1 command
Sample program to show how to use an interface in Go.
Sample program to show how to use an interface in Go.
example2 command
Sample program to show how polymorphic behavior with interfaces.
Sample program to show how polymorphic behavior with interfaces.
example3 command
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.
exercises/exercise1 command
Declare an interface named speaker with a method named sayHello.
Declare an interface named speaker with a method named sayHello.
exercises/template1 command
Declare an interface named speaker with a method named sayHello.
Declare an interface named speaker with a method named sayHello.
logging
example1 command
Sample program to show how to use the log package from the standard library.
Sample program to show how to use the log package from the standard library.
example2 command
Sample program to show how to extend the log package from the standard library.
Sample program to show how to extend the log package from the standard library.
exercises/exercise1 command
Setup a new program to use the log package.
Setup a new program to use the log package.
exercises/template1 command
Setup a new program to use the log package.
Setup a new program to use the log package.
maps
advanced/example1 command
Sample program to show how to compose maps of maps.
Sample program to show how to compose maps of maps.
advanced/example2 command
Sample program to show the properties of nil maps.
Sample program to show the properties of nil maps.
example1 command
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 command
Sample program to show how to declare and initialize a map using a map literal.
Sample program to show how to declare and initialize a map using a map literal.
example3 command
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 command
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 command
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.
Sample program to learn how to identify memory problems.
Sample program to learn how to identify memory problems.
methods
advanced/example1 command
Sample program to show how to declare function variables.
Sample program to show how to declare function variables.
example1 command
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 command
Sample program to show how to declare methods against a named type.
Sample program to show how to declare methods against a named type.
exercises/exercise1 command
Declare a struct that represents a baseball player.
Declare a struct that represents a baseball player.
exercises/template1 command
Declare a struct that represents a baseball player.
Declare a struct that represents a baseball player.
pointers
example1 command
Sample program to show the basic concept of pass by value.
Sample program to show the basic concept of pass by value.
example2 command
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 command
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 command
Sample program to show varaibles stay on or escape from the stack.
Sample program to show varaibles stay on or escape from the stack.
exercises/exercise1 command
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 command
Declare a struct type and create a value of this type.
Declare a struct type and create a value of this type.
exercises/template1 command
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 command
Declare a struct type and create a value of this type.
Declare a struct type and create a value of this type.
Sample program to show how profiling works.
Sample program to show how profiling works.
receiver_choices
exercises/exercise1 command
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 command
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.
reflection
example1 command
Sample program to show how the empty interface works.
Sample program to show how the empty interface works.
example2 command
Sample program to show how to reflect on a struct type with tags.
Sample program to show how to reflect on a struct type with tags.
example3 command
Sample program to show how to use reflection to decode an integer.
Sample program to show how to use reflection to decode an integer.
exercises/exercise1 command
Declare a struct type that represents a request for a customer invoice.
Declare a struct type that represents a request for a customer invoice.
exercises/template1 command
Declare a struct type that represents a request for a customer invoice.
Declare a struct type that represents a request for a customer invoice.
Sample program to review scheduler stats.
Sample program to review scheduler stats.
slices
advanced/example1 command
Sample program to show how to use a third index slice.
Sample program to show how to use a third index slice.
example1 command
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 command
Sample program to show the components of a slice.
Sample program to show the components of a slice.
example3 command
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 command
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 command
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.
example6 command
Sample program to show how to declare and use variadic functions.
Sample program to show how to declare and use variadic functions.
exercises/exercise1 command
Declare a nil slice of integers.
Declare a nil slice of integers.
exercises/template1 command
Declare a nil slice of integers.
Declare a nil slice of integers.
stack_trace
example1 command
Sample program to show how to read a stack trace.
Sample program to show how to read a stack trace.
example2 command
Sample program to show how to read a stack trace when it packs values.
Sample program to show how to read a stack trace when it packs values.
struct_types
advanced/example1 command
Sample program to show how struct types align on boundaries.
Sample program to show how struct types align on boundaries.
example1 command
Sample program to show how to declare and initialize struct types.
Sample program to show how to declare and initialize struct types.
example2 command
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 command
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 command
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 command
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).
testing
example4 command
Sample program that implements a simple web service.
Sample program that implements a simple web service.
example4/handlers
Package handlers provides the endpoints for the web service.
Package handlers provides the endpoints for the web service.
type_conversions
example1 command
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 command
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 command
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 command
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 command
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 command
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 command
Sample program to show how to declare variables.
Sample program to show how to declare variables.
exercises/exercise1 command
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 command
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.
writers_readers
advanced/example1 command
Sample program to show how io.Writes can be embedded within other Writer calls to perform complex writes.
Sample program to show how io.Writes can be embedded within other Writer calls to perform complex writes.
advanced/example2 command
Sample program that adds a few more features.
Sample program that adds a few more features.
example1 command
Sample program to show how different functions from the standard library use the io.Writer interface.
Sample program to show how different functions from the standard library use the io.Writer interface.
example2 command
Sample program to show how to write a simple version of curl using the io.Reader and io.Writer interface support.
Sample program to show how to write a simple version of curl using the io.Reader and io.Writer interface support.
example3 command
Sample program to show how to use a MultiWriter to perform writes to multiple devices with one write call.
Sample program to show how to use a MultiWriter to perform writes to multiple devices with one write call.
exercises/exercise1 command
Download any document from the web and display the content in the terminal and write it to a file at the same time.
Download any document from the web and display the content in the terminal and write it to a file at the same time.
exercises/template1 command
Download any document from the web and display the content in the terminal and write it to a file at the same time.
Download any document from the web and display the content in the terminal and write it to a file at the same time.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL