Directories ¶
Path | Synopsis |
---|---|
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. |
example2
Sample program to show how to use the WithCancel function of the Context package.
|
Sample program to show how to use the WithCancel function of the Context package. |
example3
Sample program to show how to use the WithDeadline function of the Context package.
|
Sample program to show how to use the WithDeadline function of the Context package. |
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. |
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. |
exercises/exercise1
Sample program that implements a simple web service using the context to handle timeouts and pass context into the request.
|
Sample program that implements a simple web service using the context to handle timeouts and pass context into the request. |
encoding
|
|
example1
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
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
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
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
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
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. |
http
|
|
api
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 a thin layer of support for writing web services.
|
Package app provides a thin layer of support for writing web services. |
io
|
|
advanced/example1
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
Sample program that adds a few more features.
|
Sample program that adds a few more features. |
example1
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
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
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. |
example4
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”. |
exercises/exercise1
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
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. |
logging
|
|
example1
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
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
Setup a new program to use the log package.
|
Setup a new program to use the log package. |
exercises/template1
Setup a new program to use the log package.
|
Setup a new program to use the log package. |
reflection
|
|
exercises/exercise1
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
Declare a struct type that represents a request for a customer invoice.
|
Declare a struct type that represents a request for a customer invoice. |
inspect/integer
Example shows how to use reflection to decode an integer.
|
Example shows how to use reflection to decode an integer. |
inspect/struct
Example shows how to inspect a structs fields and display the field name, type and value.
|
Example shows how to inspect a structs fields and display the field name, type and value. |
interface/map
Example shows how to reflect over a map of struct type values that are stored inside an interface value.
|
Example shows how to reflect over a map of struct type values that are stored inside an interface value. |
interface/pointer
Example shows how to reflect over a struct type pointer that is stored inside an interface value.
|
Example shows how to reflect over a struct type pointer that is stored inside an interface value. |
interface/slice
Example shows how to reflect over a slice of struct type values that are stored inside an interface value.
|
Example shows how to reflect over a slice of struct type values that are stored inside an interface value. |
interface/struct
Example shows how to reflect over a struct type value that is stored inside an interface value.
|
Example shows how to reflect over a struct type value that is stored inside an interface value. |
tag
Example shows how to reflect on a struct type with tags.
|
Example shows how to reflect on a struct type with tags. |
Click to show internal directories.
Click to hide internal directories.