src/

directory
v0.0.0-...-66e828a Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: MIT

Directories

Path Synopsis
chapter1
chapter10
listing01
Sample program demonstrating struct composition.
Sample program demonstrating struct composition.
listing02
Sample program demonstrating decoupling with interfaces.
Sample program demonstrating decoupling with interfaces.
listing03
Sample program demonstrating interface composition.
Sample program demonstrating interface composition.
listing04
Sample program demonstrating decoupling with interface composition.
Sample program demonstrating decoupling with interface composition.
listing05
Sample program demonstrating when implicit interface conversions are provided by the compiler.
Sample program demonstrating when implicit interface conversions are provided by the compiler.
listing06
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.
listing06/pubsub
Package pubsub simulates a package that provides publication/subscription type services.
Package pubsub simulates a package that provides publication/subscription type services.
chapter2
chapter3
dbdriver
Sample program to show how to show you how to briefly work with the sql package.
Sample program to show how to show you how to briefly work with the sql package.
wordcount
Sample program to show how to show you how to briefly work with io.
Sample program to show how to show you how to briefly work with io.
words
Package words provides support for counting words.
Package words provides support for counting words.
chapter5
listing11
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.
listing34
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.
listing35
Sample program to show how a bytes.Buffer can also be used with the io.Copy function.
Sample program to show how a bytes.Buffer can also be used with the io.Copy function.
listing36
Sample program to show how to use an interface in Go.
Sample program to show how to use an interface in Go.
listing46
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.
listing48
Sample program to show how polymorphic behavior with interfaces.
Sample program to show how polymorphic behavior with interfaces.
listing50
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.
listing56
Sample program to show how embedded types work with interfaces.
Sample program to show how embedded types work with interfaces.
listing60
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.
listing64
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.
listing64/counters
Package counters provides alert counter support.
Package counters provides alert counter support.
listing68
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.
listing68/counters
Package counters provides alert counter support.
Package counters provides alert counter support.
listing71
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.
listing71/entities
Package entities contains support for types of people in the system.
Package entities contains support for types of people in the system.
listing74
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.
listing74/entities
Package entities contains support for types of people in the system.
Package entities contains support for types of people in the system.
chapter6
listing01
This sample program demonstrates how to create goroutines and how the scheduler behaves.
This sample program demonstrates how to create goroutines and how the scheduler behaves.
listing04
This sample program demonstrates how the goroutine scheduler will time slice goroutines on a single thread.
This sample program demonstrates how the goroutine scheduler will time slice goroutines on a single thread.
listing07
This sample program demonstrates how to create goroutines and how the goroutine scheduler behaves with two logical processor.
This sample program demonstrates how to create goroutines and how the goroutine scheduler behaves with two logical processor.
listing09
This sample program demonstrates how to create race conditions in our programs.
This sample program demonstrates how to create race conditions in our programs.
listing13
This sample program demonstrates how to use the atomic package to provide safe access to numeric types.
This sample program demonstrates how to use the atomic package to provide safe access to numeric types.
listing15
This sample program demonstrates how to use the atomic package functions Store and Load to provide safe access to numeric types.
This sample program demonstrates how to use the atomic package functions Store and Load to provide safe access to numeric types.
listing16
This sample program demonstrates how to use a mutex to define critical sections of code that need synchronous access.
This sample program demonstrates how to use a mutex to define critical sections of code that need synchronous access.
listing20
This sample program demonstrates how to use an unbuffered channel to simulate a game of tennis between two goroutines.
This sample program demonstrates how to use an unbuffered channel to simulate a game of tennis between two goroutines.
listing22
This sample program demonstrates how to use an unbuffered channel to simulate a relay race between four goroutines.
This sample program demonstrates how to use an unbuffered channel to simulate a relay race between four goroutines.
listing24
This sample program demonstrates how to use a buffered channel to work on multiple tasks with a predefined number of goroutines.
This sample program demonstrates how to use a buffered channel to work on multiple tasks with a predefined number of goroutines.
chapter7
patterns/pool
Example provided with help from Fatih Arslan and Gabriel Aszalos.
Example provided with help from Fatih Arslan and Gabriel Aszalos.
patterns/pool/main
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.
patterns/runner
Example is provided with help by Gabriel Aszalos.
Example is provided with help by Gabriel Aszalos.
patterns/runner/main
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.
patterns/search
Package search : search.go manages the searching of results against Google, Yahoo and Bing.
Package search : search.go manages the searching of results against Google, Yahoo and Bing.
patterns/search/main
This sample program demonstrates how to implement a pattern for concurrent requesting results from different systems and either wait for all the results to return or just the first one.
This sample program demonstrates how to implement a pattern for concurrent requesting results from different systems and either wait for all the results to return or just the first one.
patterns/semaphore
This sample program demonstrates how to implement a semaphore using channels that can allow multiple reads but a single write.
This sample program demonstrates how to implement a semaphore using channels that can allow multiple reads but a single write.
patterns/work
Example provided with help from Jason Waldrip.
Example provided with help from Jason Waldrip.
patterns/work/main
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.
chapter8
listing03
This sample program demonstrates how to use the base log package.
This sample program demonstrates how to use the base log package.
listing11
This sample program demonstrates how to create customized loggers.
This sample program demonstrates how to create customized loggers.
listing24
This sample program demonstrates how to decode a JSON response using the json package and NewDecoder function.
This sample program demonstrates how to decode a JSON response using the json package and NewDecoder function.
listing27
This sample program demonstrates how to decode a JSON string.
This sample program demonstrates how to decode a JSON string.
listing29
This sample program demonstrates how to decode a JSON string.
This sample program demonstrates how to decode a JSON string.
listing31
This sample program demonstrates how to marshal a JSON string.
This sample program demonstrates how to marshal a JSON string.
listing37
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.
listing46
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.
chapter9
listing17
This sample code implement a simple web service.
This sample code implement a simple web service.
listing17/handlers
Package handlers provides the endpoints for the web service.
Package handlers provides the endpoints for the web service.

Jump to

Keyboard shortcuts

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