Directories
¶
Path | Synopsis |
---|---|
content
|
|
docs/concurrency/channels/advanced/example1
Sample program to show the order of channel communication for unbuffered, buffered and closing channels based on the specification.
|
Sample program to show the order of channel communication for unbuffered, buffered and closing channels based on the specification. |
docs/concurrency/channels/example1
This sample program demonstrates the basic channel mechanics for goroutine signaling.
|
This sample program demonstrates the basic channel mechanics for goroutine signaling. |
docs/concurrency/channels/example2
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. |
docs/concurrency/channels/example3
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. |
docs/concurrency/channels/example4
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. |
docs/concurrency/channels/example5
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. |
docs/concurrency/channels/exercises/exercise1
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. |
docs/concurrency/channels/exercises/exercise2
Write a program that uses a fan out pattern to generate 100 random numbers concurrently.
|
Write a program that uses a fan out pattern to generate 100 random numbers concurrently. |
docs/concurrency/channels/exercises/exercise3
Write a program that uses goroutines to generate up to 100 random numbers.
|
Write a program that uses goroutines to generate up to 100 random numbers. |
docs/concurrency/channels/exercises/exercise4
Write a program that creates a fixed set of workers to generate random numbers.
|
Write a program that creates a fixed set of workers to generate random numbers. |
docs/concurrency/context/example1
Sample program to show how to store and retrieve values from a context.
|
Sample program to show how to store and retrieve values from a context. |
docs/concurrency/context/example2
Sample program to show how to use the WithCancel function.
|
Sample program to show how to use the WithCancel function. |
docs/concurrency/context/example3
Sample program to show how to use the WithDeadline function.
|
Sample program to show how to use the WithDeadline function. |
docs/concurrency/context/example4
Sample program to show how to use the WithTimeout function of the Context package.
|
Sample program to show how to use the WithTimeout function of the Context package. |
docs/concurrency/context/example5
Sample program that implements a web request with a context that is used to timeout the request if it takes too long.
|
Sample program that implements a web request with a context that is used to timeout the request if it takes too long. |
docs/concurrency/context/example6
Sample program to show when a Context is canceled, all Contexts derived from it are also canceled.
|
Sample program to show when a Context is canceled, all Contexts derived from it are also canceled. |
docs/concurrency/context/exercise1
Use the template and follow the directions.
|
Use the template and follow the directions. |
docs/concurrency/data_race/advanced/example1
Sample program to show a more complicated race condition using an interface value.
|
Sample program to show a more complicated race condition using an interface value. |
docs/concurrency/data_race/example1
Sample program to show how to create race conditions in our programs.
|
Sample program to show how to create race conditions in our programs. |
docs/concurrency/data_race/example2
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. |
docs/concurrency/data_race/example3
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. |
docs/concurrency/data_race/example4
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. |
docs/concurrency/data_race/example5
Sample program to show how maps are not safe for concurrent use by default.
|
Sample program to show how maps are not safe for concurrent use by default. |
docs/concurrency/data_race/exercise1
Fix the race condition in this program.
|
Fix the race condition in this program. |
docs/concurrency/goroutines/example1
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. |
docs/concurrency/goroutines/example2
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. |
docs/concurrency/goroutines/example3
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. |
docs/concurrency/goroutines/exercise1
Create a program that declares two anonymous functions.
|
Create a program that declares two anonymous functions. |
docs/concurrency/patterns/advanced
This sample program demonstrates how the logger package works.
|
This sample program demonstrates how the logger package works. |
docs/design/composition/assertions/example1
Sample program demonstrating when implicit interface conversions are provided by the compiler.
|
Sample program demonstrating when implicit interface conversions are provided by the compiler. |
docs/design/composition/assertions/example2
Sample program demonstrating that type assertions are a runtime and not compile time construct.
|
Sample program demonstrating that type assertions are a runtime and not compile time construct. |
docs/design/composition/assertions/example3
Sample program to show how method sets can affect behavior.
|
Sample program to show how method sets can affect behavior. |
docs/design/composition/decoupling/example1
Sample program demonstrating struct composition.
|
Sample program demonstrating struct composition. |
docs/design/composition/decoupling/example2
Sample program demonstrating decoupling with interfaces.
|
Sample program demonstrating decoupling with interfaces. |
docs/design/composition/decoupling/example3
Sample program demonstrating interface composition.
|
Sample program demonstrating interface composition. |
docs/design/composition/decoupling/example4
Sample program demonstrating decoupling with interface composition.
|
Sample program demonstrating decoupling with interface composition. |
docs/design/composition/decoupling/example5
Sample program demonstrating removing interface pollution.
|
Sample program demonstrating removing interface pollution. |
docs/design/composition/decoupling/example6
Sample program demonstrating being more precise with API design.
|
Sample program demonstrating being more precise with API design. |
docs/design/composition/exercises/exercise1
Using the template, declare a set of concrete types that implement the set of predefined interface types.
|
Using the template, declare a set of concrete types that implement the set of predefined interface types. |
docs/design/composition/grouping/example1
This is an example of using type hierarchies with a OOP pattern.
|
This is an example of using type hierarchies with a OOP pattern. |
docs/design/composition/grouping/example2
This is an example of using composition and interfaces.
|
This is an example of using composition and interfaces. |
docs/design/composition/mocking/example1
Sample program to show how you can personally mock concrete types when you need to for your own packages or tests.
|
Sample program to show how you can personally mock concrete types when you need to for your own packages or tests. |
docs/design/composition/mocking/example1/pubsub
Package pubsub simulates a package that provides publication/subscription type services.
|
Package pubsub simulates a package that provides publication/subscription type services. |
docs/design/composition/pollution/example1
This is an example that creates interface pollution by improperly using an interface when one is not needed.
|
This is an example that creates interface pollution by improperly using an interface when one is not needed. |
docs/design/composition/pollution/example2
This is an example that removes the interface pollution by removing the interface and using the concrete type directly.
|
This is an example that removes the interface pollution by removing the interface and using the concrete type directly. |
docs/design/error_handling/example1
Sample program to show how the default error type is implemented.
|
Sample program to show how the default error type is implemented. |
docs/design/error_handling/example2
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. |
docs/design/error_handling/example3
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. |
docs/design/error_handling/example4
Package example4 provides code to show how to implement behavior as context.
|
Package example4 provides code to show how to implement behavior as context. |
docs/design/error_handling/example5
Sample program to show see if the class can find the bug.
|
Sample program to show see if the class can find the bug. |
docs/design/error_handling/example5/reason
Sample program to show see if the class can find the bug.
|
Sample program to show see if the class can find the bug. |
docs/design/error_handling/example6
Sample program to show how wrapping errors work.
|
Sample program to show how wrapping errors work. |
docs/design/error_handling/exercise1
Create two error variables, one called ErrInvalidValue and the other called ErrAmountTooLarge.
|
Create two error variables, one called ErrInvalidValue and the other called ErrAmountTooLarge. |
docs/design/error_handling/exercise2
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. |
docs/language/arrays/benchmarks/caching
Package caching provides code to show why Data Oriented Design matters.
|
Package caching provides code to show why Data Oriented Design matters. |
docs/language/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. |
docs/language/arrays/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. |
docs/language/arrays/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. |
docs/language/arrays/example4
Sample program to show how the for range has both value and pointer semantics.
|
Sample program to show how the for range has both value and pointer semantics. |
docs/language/arrays/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. |
docs/language/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. |
docs/language/constants/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. |
docs/language/constants/example3
Sample program to show how iota works.
|
Sample program to show how iota works. |
docs/language/constants/example4
Sample program to show how literal, constant and variables work within the scope of implicit conversion.
|
Sample program to show how literal, constant and variables work within the scope of implicit conversion. |
docs/language/constants/exercise1
Declare an untyped and typed constant and display their values.
|
Declare an untyped and typed constant and display their values. |
docs/language/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. |
docs/language/embedding/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. |
docs/language/embedding/example3
Sample program to show how embedded types work with interfaces.
|
Sample program to show how embedded types work with interfaces. |
docs/language/embedding/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. |
docs/language/embedding/exercise1
This program defines a type Feed with two methods: Count and Fetch.
|
This program defines a type Feed with two methods: Count and Fetch. |
docs/language/exporting/example1
Sample program to show how to access an exported identifier.
|
Sample program to show how to access an exported identifier. |
docs/language/exporting/example1/counters
Package counters provides alert counter support.
|
Package counters provides alert counter support. |
docs/language/exporting/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. |
docs/language/exporting/example2/counters
Package counters provides alert counter support.
|
Package counters provides alert counter support. |
docs/language/exporting/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. |
docs/language/exporting/example3/counters
Package counters provides alert counter support.
|
Package counters provides alert counter support. |
docs/language/exporting/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. |
docs/language/exporting/example4/users
Package users provides support for user management.
|
Package users provides support for user management. |
docs/language/exporting/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. |
docs/language/exporting/example5/users
Package users provides support for user management.
|
Package users provides support for user management. |
docs/language/exporting/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. |
docs/language/exporting/exercise1/toy
Package toy contains support for managing toy inventory.
|
Package toy contains support for managing toy inventory. |
docs/language/functions/advanced/example1
Sample program to show how to recover from panics.
|
Sample program to show how to recover from panics. |
docs/language/functions/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. |
docs/language/functions/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. |
docs/language/functions/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. |
docs/language/functions/example4
Sample program to show how anonymous functions and closures work.
|
Sample program to show how anonymous functions and closures work. |
docs/language/functions/exercise1
Declare a struct type to maintain information about a user.
|
Declare a struct type to maintain information about a user. |
docs/language/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. |
docs/language/interfaces/example1
Sample program to show how polymorphic behavior with interfaces.
|
Sample program to show how polymorphic behavior with interfaces. |
docs/language/interfaces/example2
Sample program to show how to understand method sets.
|
Sample program to show how to understand method sets. |
docs/language/interfaces/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. |
docs/language/interfaces/example4
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. |
docs/language/interfaces/exercise1
Declare an interface named speaker with a method named speak.
|
Declare an interface named speaker with a method named speak. |
docs/language/maps/example1
Sample program to show how to initialize a map, write to it, then read and delete from it.
|
Sample program to show how to initialize a map, write to it, then read and delete from it. |
docs/language/maps/example2
Sample program to show how maps behave when you read an absent key.
|
Sample program to show how maps behave when you read an absent key. |
docs/language/maps/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. |
docs/language/maps/example4
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. |
docs/language/maps/example5
Sample program to show how to walk through a map by alphabetical key order.
|
Sample program to show how to walk through a map by alphabetical key order. |
docs/language/maps/example6
Sample program to show that you cannot take the address of an element in a map.
|
Sample program to show that you cannot take the address of an element in a map. |
docs/language/maps/example7
Sample program to show how maps are reference types.
|
Sample program to show how maps are reference types. |
docs/language/maps/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. |
docs/language/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. |
docs/language/methods/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. |
docs/language/methods/example3
Sample program to show how to declare function variables.
|
Sample program to show how to declare function variables. |
docs/language/methods/example4
Sample program to show how to declare and use function types.
|
Sample program to show how to declare and use function types. |
docs/language/methods/exercise1
Declare a struct that represents a baseball player.
|
Declare a struct that represents a baseball player. |
docs/language/pointers/example1
Sample program to show the basic concept of pass by value.
|
Sample program to show the basic concept of pass by value. |
docs/language/pointers/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. |
docs/language/pointers/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. |
docs/language/pointers/example4
Sample program to teach the mechanics of escape analysis.
|
Sample program to teach the mechanics of escape analysis. |
docs/language/pointers/example5
Sample program to show how stacks grow/change.
|
Sample program to show how stacks grow/change. |
docs/language/pointers/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. |
docs/language/pointers/exercise2
Declare a struct type and create a value of this type.
|
Declare a struct type and create a value of this type. |
docs/language/slices/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. |
docs/language/slices/example2
Sample program to show the components of a slice.
|
Sample program to show the components of a slice. |
docs/language/slices/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. |
docs/language/slices/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. |
docs/language/slices/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. |
docs/language/slices/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. |
docs/language/slices/example7
Sample program to show how to declare and use variadic functions.
|
Sample program to show how to declare and use variadic functions. |
docs/language/slices/example8
Sample program to show how the for range has both value and pointer semantics.
|
Sample program to show how the for range has both value and pointer semantics. |
docs/language/slices/exercise1
Declare a nil slice of integers.
|
Declare a nil slice of integers. |
docs/language/struct_types/example1
Sample program to show how to declare and initialize struct types.
|
Sample program to show how to declare and initialize struct types. |
docs/language/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. |
docs/language/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. |
docs/language/struct_types/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). |
docs/language/variables/example1
Sample program to show how to declare variables.
|
Sample program to show how to declare variables. |
docs/language/variables/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. |
docs/profiling/bce
Package bce shows a sample function that does not take into consideration the extra bounds checks that the compiler places in code for integrity.
|
Package bce shows a sample function that does not take into consideration the extra bounds checks that the compiler places in code for integrity. |
docs/profiling/godebug
Sample program that implements a simple web service that will allow us to explore how to use the GODEBUG variable.
|
Sample program that implements a simple web service that will allow us to explore how to use the GODEBUG variable. |
docs/profiling/http_trace/example1
Sample program to show how the httptrace package provides a number of hooks to gather information during an HTTP round trip about a variety of events.
|
Sample program to show how the httptrace package provides a number of hooks to gather information during an HTTP round trip about a variety of events. |
docs/profiling/http_trace/example2
Sample program to show how to use the http trace with a unique Client and Transport.
|
Sample program to show how to use the http trace with a unique Client and Transport. |
docs/profiling/memcpu
Sample program that takes a stream of bytes and looks for the bytes “elvis” and when they are found, replace them with “Elvis”.
|
Sample program that takes a stream of bytes and looks for the bytes “elvis” and when they are found, replace them with “Elvis”. |
docs/profiling/pprof
Sample program that implements a simple web service that will allow us to explore how to use the http/pprof tooling.
|
Sample program that implements a simple web service that will allow us to explore how to use the http/pprof tooling. |
docs/profiling/project/search
Package search manages the searching of results against different news feeds.
|
Package search manages the searching of results against different news feeds. |
docs/profiling/project/service
Package service maintains the logic for the web service.
|
Package service maintains the logic for the web service. |
docs/profiling/stack_trace/example1
Sample program to show how to read a stack trace.
|
Sample program to show how to read a stack trace. |
docs/profiling/stack_trace/example2
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. |
docs/profiling/stack_trace/example3
Sample program that implements a simple web service that will allow us to explore how to look at core dumps.
|
Sample program that implements a simple web service that will allow us to explore how to look at core dumps. |
docs/profiling/trace
Sample program that performs a series of I/O related tasks to better understand tracing in Go.
|
Sample program that performs a series of I/O related tasks to better understand tracing in Go. |
docs/testing/benchmarks/caching
Package caching provides code to show why Data Oriented Design matters.
|
Package caching provides code to show why Data Oriented Design matters. |
docs/testing/benchmarks/cpu-bound
Understanding your workload is critically important in understanding if something can be made concurrent and how complex it is to perform.
|
Understanding your workload is critically important in understanding if something can be made concurrent and how complex it is to perform. |
docs/testing/benchmarks/io-bound
Understanding your workload is critically important in understanding if something can be made concurrent and how complex it is to perform.
|
Understanding your workload is critically important in understanding if something can be made concurrent and how complex it is to perform. |
docs/testing/tests/example4
Sample program that implements a simple web service.
|
Sample program that implements a simple web service. |
docs/testing/tests/example4/handlers
Package handlers provides the endpoints for the web service.
|
Package handlers provides the endpoints for the web service. |
Click to show internal directories.
Click to hide internal directories.