eng-golang-workshop

module
v0.0.0-...-94c99f4 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: Apache-2.0

README

BBC Gophers — Go Language Workshop

func main() {
	fmt.Println("Hello, BBC Gophers!")
}

The Workshop

We are on Slack in the #eng-golang channel.

Our workshop text is: The Go Programming Language by Alan Donovan and Brian W. Kernighan

Work through the course text at a speed that suits you. We also have meetups booked to meet to chat about Go and the book etc. So just join in any time! :)

1. Begin

To begin, create your own directory in the workspaces directory, work through the book exercises, and add your code there. You can add your code in separate directories if you're using Go Modules or if you're using a GOPATH you could structure your code as in the GOPATH Project Structure section.

If you need the exercises from the book, they're available in exercises.tar.gz zipped archive but these are already in the book so you might not need them.

2. Installing Go

a. Home/Linuxbrew

It may be convenient to install the latest version of Go through the Homebrew and Linuxbrew package managers.

brew install go
b. Install with Binary Distributions

The https://golang.org/dl/ page contains distros for Windows, MacOS, Linux, and source. The installation instructions explains how to install them.

3. Getting the Workshop Code

You can grab the code samples used in the book (which you update for a bunch of the exercises) by running such as:

go get gopl.io/ch1/helloworld

(This will get the helloworld code, plus the other examples).

4. Building and Running Go

There are two main options, by setting a GOPATH and having all of your code in one location or using Go Modules which allow you to split your code into separate locations. It might be easier to use a GOPATH pointing to all of your workshop code but you might find modules more appropriate.

a. Running Go with a GOPATH

The traditional way to run/build Go code (prior to Go Modules) is using a GOPATH. You should set your $GOPATH to your current directory, such as:

export GOPATH=/home/gopherg/eng-golang-workshop/workspaces/gogopher

To run some code you can then use:

go run gopl.io/ch1/helloworld

(which actually builds then executes /home/gopherg/eng-golang-workshop/workspaces/gogopher/src/gopl.io/ch1/helloworld/main.go)

To build it and output in your $GOPATH\bin directory:

go build -o $GOPATH/bin/helloworld gopl.io/ch1/helloworld

To get another module (such as the imaginary some/dependency):

go get github.com/some/dependency

...and this will then be downloaded to $GOPATH/src/github.com/some/dependency and imported with import "github.com/some/dependency"

GOPATH Project Structure

When using GOPATH your project structure may be something like:

workspaces
    gogopher\
        bin\
            helloworld
            ...
        src\
            gogopher.io\
                ch1\
                    ex1_1\
                        main.go
                ...
b. Running Go with Go Modules)

Go modules are an new feature in Go 1.11 which removes the need to have a $GOPATH set.

To use modules in your project directory, run:

go mod init example.com/foo

...where example.com is replaced with your own domain name (or something like github.com if your code is in a github repo) and foo is your package/component name. This will create a file called go.mod.

If you have a main function in your project directory you can also run your code using:

go run .

...and build it using:

go build .

...etc.

To include a module to your project you can add the external module to your go.mod file which would look like:

module example.com/foo

require (
    github.com/some/dependency v1.2.3
)

...then import it and use it in your code:

package main

import "github.com/some/dependency"

func main() {
    dependency.f()
}

Your own local packages are imported such as import "example.com/foo/package".

5. Development Environments

a. Delve (Debugger)

Delve is is a debugger for Go. To install run:

go get -u github.com/derekparker/delve/cmd/dlv

To see the available commands, run dlv then help at the (dlv) prompt.

b. GoLand

GoLand is a new commercial Go IDE by JetBrains aimed at providing an ergonomic environment for Go development.

The new IDE extends the IntelliJ platform with coding assistance and tool integrations specific for the Go language.

c. Emacs

If you follow similar instructions to get go support for emacs (OS X) as below http://tleyden.github.io/blog/2014/05/22/configure-emacs-as-a-go-editor-from-scratch/

And you run into the following error when trying to get auto-complete to work.

Error running timer ‘ac-update-greedy’: (file-missing "Searching for program" "No such file or directory" "gocode")
Error running timer ‘ac-show-menu’: (file-missing "Searching for program" "No such file or directory" "gocode")
Error running timer ‘ac-update-greedy’: (file-missing "Searching for program" "No such file or directory" "gocode"

Then the problem is probably down to gocode not being available in your path: https://emacs.stackexchange.com/questions/10722/emacs-and-command-line-path-disagreements-on-osx

So if you edit /etc/paths.d/go and add the path to the bin directory of your project it should fix problem.

d. Atom

Atom supports Go development with the go-plus package.

To use Delve inside Atom, install the go-debug package.

To run your Go code in Atom, install the atom-runner package.

A Tour of Go

How to Write Go Code

Effective Go

Source code: The Go Programming Language

YouTube: Concurrency is not Parallelism by Rob Pike

YouTube: Go Proverbs

7. Rights

All exercises from The Go Programming Language are copyright 2016 Alan A. A. Donovan & Brian W. Kernighan and included with permission from the authors.

All submitted code is covered under Apache License 2.0.

Directories

Path Synopsis
workspaces
betandr/src/andr.io/ch1/ex1_1
Modify the `echo` program to also allow print `os.Args[0]`, the name of the command that invoked it.
Modify the `echo` program to also allow print `os.Args[0]`, the name of the command that invoked it.
betandr/src/andr.io/ch1/ex1_10
Try `fetchall` with longer argument lists, such as samples from the top million web sites available at `alexa.com`.
Try `fetchall` with longer argument lists, such as samples from the top million web sites available at `alexa.com`.
betandr/src/andr.io/ch1/ex1_12
Modify the Lissajous server to read parameter values from the URL.
Modify the Lissajous server to read parameter values from the URL.
betandr/src/andr.io/ch1/ex1_2
Modify the `echo` program to print the index and value of each of its arguments, one per line.
Modify the `echo` program to print the index and value of each of its arguments, one per line.
betandr/src/andr.io/ch1/ex1_3
Experiment to measure the difference in running time between our potentially inefficient versions and the one that uses `strings.Join`.
Experiment to measure the difference in running time between our potentially inefficient versions and the one that uses `strings.Join`.
betandr/src/andr.io/ch1/ex1_4
Modify `dup2` to print the names of all files in which each duplicated line occurs.
Modify `dup2` to print the names of all files in which each duplicated line occurs.
betandr/src/andr.io/ch1/ex1_5
Change the Lissajous program's color palette to green on black, for added authenticity.
Change the Lissajous program's color palette to green on black, for added authenticity.
betandr/src/andr.io/ch1/ex1_6
Modify the Lissajous program to produce images in multiple colors by adding more values to `palette` and then displaying them by changing the third argument of `SetColorIndex` in some interesting way.
Modify the Lissajous program to produce images in multiple colors by adding more values to `palette` and then displaying them by changing the third argument of `SetColorIndex` in some interesting way.
betandr/src/andr.io/ch1/ex1_7
The function call `io.Copy(dst, src)` reads from `src` and writes to `dst`.
The function call `io.Copy(dst, src)` reads from `src` and writes to `dst`.
betandr/src/andr.io/ch1/ex1_8
Modify `fetch` to add the prefix `http://` to each argument URL, if it is missing.
Modify `fetch` to add the prefix `http://` to each argument URL, if it is missing.
betandr/src/andr.io/ch1/ex1_9
Modify `fetch` to also print the HTTP status code, found in `resp.Status`.
Modify `fetch` to also print the HTTP status code, found in `resp.Status`.
betandr/src/andr.io/ch2/ex2_1
Add types, constants, and functions to `tempconv` for processing temperatures in the Kelvin scale, where Kelvin is -273.15°C and a difference of 1K has the same magnitude as 1°C.
Add types, constants, and functions to `tempconv` for processing temperatures in the Kelvin scale, where Kelvin is -273.15°C and a difference of 1K has the same magnitude as 1°C.
betandr/src/andr.io/ch2/ex2_2
Write a general purpose unit-conversion program analogous to `cf` that reads numbers from its command-line arguments or from the standard imput if there are no arguments, and converts each nunber into units like temperature in Celsius and Fahrenheit, length in feet and meters, weight in pounds, kilograms, and the like.
Write a general purpose unit-conversion program analogous to `cf` that reads numbers from its command-line arguments or from the standard imput if there are no arguments, and converts each nunber into units like temperature in Celsius and Fahrenheit, length in feet and meters, weight in pounds, kilograms, and the like.
betandr/src/andr.io/ch2/ex2_2/weightconv
Write a general purpose unit-conversion program analogous to `cf` that reads numbers from its command-line arguments or from the standard imput if there are no arguments, and converts each nunber into units like temperature in Celsius and Fahrenheit, length in feet and meters, weight in pounds, kilograms, and the like.
Write a general purpose unit-conversion program analogous to `cf` that reads numbers from its command-line arguments or from the standard imput if there are no arguments, and converts each nunber into units like temperature in Celsius and Fahrenheit, length in feet and meters, weight in pounds, kilograms, and the like.
betandr/src/andr.io/ch2/ex2_3
Rewrite `PopCount` to use a loop instead of a single expression.
Rewrite `PopCount` to use a loop instead of a single expression.
betandr/src/andr.io/ch2/ex2_3/popcount
Rewrite `PopCount` to use a loop instead of a single expression.
Rewrite `PopCount` to use a loop instead of a single expression.
betandr/src/andr.io/ch2/ex2_4
Write a version of `PopCount` that counts bits by shifting its argument through 64 bit positions, testing the rightmost bit each time.
Write a version of `PopCount` that counts bits by shifting its argument through 64 bit positions, testing the rightmost bit each time.
betandr/src/andr.io/ch2/ex2_4/popcount
Write a version of `PopCount` that counts bits by shifting its argument through 64 bit positions, testing the rightmost bit each time.
Write a version of `PopCount` that counts bits by shifting its argument through 64 bit positions, testing the rightmost bit each time.
betandr/src/andr.io/ch2/ex2_5
The expression `x&(x-1)` clears the rightmost non-zero bit of x.
The expression `x&(x-1)` clears the rightmost non-zero bit of x.
betandr/src/andr.io/ch2/ex2_5/popcount
The expression `x&(x-1)` clears the rightmost non-zero bit of x.
The expression `x&(x-1)` clears the rightmost non-zero bit of x.
betandr/src/andr.io/ch3/ex3_1
If the function `f` returns a non-finite `float64` value, the SVG file will contain invalid `<polygon>` elements (although many SVG renderers handle this gracefully).
If the function `f` returns a non-finite `float64` value, the SVG file will contain invalid `<polygon>` elements (although many SVG renderers handle this gracefully).
betandr/src/andr.io/ch3/ex3_10
Write a non-recursive version of `comma`, using `bytes.Buffer` instead of string concatenation.
Write a non-recursive version of `comma`, using `bytes.Buffer` instead of string concatenation.
betandr/src/andr.io/ch3/ex3_11
Enhance `comma` so it deals correctly with floating-point numbers and an optional sign.
Enhance `comma` so it deals correctly with floating-point numbers and an optional sign.
betandr/src/andr.io/ch3/ex3_12
Write a function that reports whether two strings are anagrams of each other, that is, they contain the same letters in a different order.
Write a function that reports whether two strings are anagrams of each other, that is, they contain the same letters in a different order.
betandr/src/andr.io/ch3/ex3_13
Write const declarations for KB, MB, up through YB as compactly as you can.
Write const declarations for KB, MB, up through YB as compactly as you can.
betandr/src/andr.io/ch3/ex3_2
Experiment with vizualizations of other functions from the `math` package.
Experiment with vizualizations of other functions from the `math` package.
betandr/src/andr.io/ch3/ex3_3
Color each polygon based on its height, so that the peaks are colored red (`#ff0000`) and the valleys blue ('#0000ff').
Color each polygon based on its height, so that the peaks are colored red (`#ff0000`) and the valleys blue ('#0000ff').
betandr/src/andr.io/ch3/ex3_4
Following the approach of the Lissajous example in Section 1.7, construct a web server that computes surfaces and writes SVG data to the client.
Following the approach of the Lissajous example in Section 1.7, construct a web server that computes surfaces and writes SVG data to the client.
betandr/src/andr.io/ch3/ex3_5
Implement a full-color Mandelbrot set using the function `image.NewRBA` and the type `color.RGBA` or `color.YCbCr`.
Implement a full-color Mandelbrot set using the function `image.NewRBA` and the type `color.RGBA` or `color.YCbCr`.
betandr/src/andr.io/ch3/ex3_6
Supersampling is a technique to reduce the effect of pixelation by computing the color value at several points within each pixel and taking the average.
Supersampling is a technique to reduce the effect of pixelation by computing the color value at several points within each pixel and taking the average.
betandr/src/andr.io/ch3/ex3_7
Another simple fractal uses Newton's method to find complex solutions to a function such as `z^4-1 = 0`.
Another simple fractal uses Newton's method to find complex solutions to a function such as `z^4-1 = 0`.
betandr/src/andr.io/ch3/ex3_8
Rendering fractals at high zoom levels demands great arithmetic precision.
Rendering fractals at high zoom levels demands great arithmetic precision.
betandr/src/andr.io/ch3/ex3_8/mandelbrot
Rendering fractals at high zoom levels demands great arithmetic precision.
Rendering fractals at high zoom levels demands great arithmetic precision.
betandr/src/andr.io/ch3/ex3_9
Write a web server that renders fractals and writes the image data to the client.
Write a web server that renders fractals and writes the image data to the client.
betandr/src/andr.io/ch4/ex4_1
Write a function that counts the number of bits that are different in two SHA256 hashes.
Write a function that counts the number of bits that are different in two SHA256 hashes.
betandr/src/andr.io/ch4/ex4_1/popcount
Write a function that counts the number of bits that are different in two SHA256 hashes.
Write a function that counts the number of bits that are different in two SHA256 hashes.
betandr/src/andr.io/ch4/ex4_10
Issues prints a table of GitHub issues matching the search terms and reports the results in age categories of this month, this year, and older than a year.
Issues prints a table of GitHub issues matching the search terms and reports the results in age categories of this month, this year, and older than a year.
betandr/src/andr.io/ch4/ex4_10/github
Package github provides a Go API for the GitHub issue tracker.
Package github provides a Go API for the GitHub issue tracker.
betandr/src/andr.io/ch4/ex4_11
Build a tool that lets users create, read, update, and close GitHub i̶s̶s̶u̶e̶s̶ pull requests from the command line, invoking their preferred text editor when substantial text input is required.
Build a tool that lets users create, read, update, and close GitHub i̶s̶s̶u̶e̶s̶ pull requests from the command line, invoking their preferred text editor when substantial text input is required.
betandr/src/andr.io/ch4/ex4_13
The JSON-based web service of the Open Movie Database lets you search https://omdbapi.com/ for a movie by name and download its poster image.
The JSON-based web service of the Open Movie Database lets you search https://omdbapi.com/ for a movie by name and download its poster image.
betandr/src/andr.io/ch4/ex4_14
Create a web server that queries GitHub once and then allows navigation of the list of bug reports, milestones, and users.
Create a web server that queries GitHub once and then allows navigation of the list of bug reports, milestones, and users.
betandr/src/andr.io/ch4/ex4_2
Write a program that prints the SHA256 hash of it standard input by default but supports a command-line flag to print the SHA384 or SHA512 hash instead.
Write a program that prints the SHA256 hash of it standard input by default but supports a command-line flag to print the SHA384 or SHA512 hash instead.
betandr/src/andr.io/ch4/ex4_5
Write an in-place function to eliminate adjacent duplicates in a []string slice.
Write an in-place function to eliminate adjacent duplicates in a []string slice.
betandr/src/andr.io/ch4/ex4_8
Modify charcount to count letters, digits, and so on in their Unicode categories, using functions like `unicode.IsLetter`.
Modify charcount to count letters, digits, and so on in their Unicode categories, using functions like `unicode.IsLetter`.
betandr/src/andr.io/ch5/ex5_1
Change the findlinks program to traverse the `n.FirstChild` linked list using recursive calls to `visit` instead of a loop.
Change the findlinks program to traverse the `n.FirstChild` linked list using recursive calls to `visit` instead of a loop.
betandr/src/andr.io/ch5/ex5_10
Rewrite `toposort` to use maps instead of slices and eliminate the initial sort.
Rewrite `toposort` to use maps instead of slices and eliminate the initial sort.
betandr/src/andr.io/ch5/ex5_11
The instructor of the linear algebra course decides that calculus is now a prerequisite.
The instructor of the linear algebra course decides that calculus is now a prerequisite.
betandr/src/andr.io/ch5/ex5_12
The `startElement` and `endElement` functions in gopl.io/ch5/outline2 (§5.5) share a global variable, `depth`.
The `startElement` and `endElement` functions in gopl.io/ch5/outline2 (§5.5) share a global variable, `depth`.
betandr/src/andr.io/ch5/ex5_13
Modify crawl to make local copies of the pages it finds, creating directories as necessary.
Modify crawl to make local copies of the pages it finds, creating directories as necessary.
betandr/src/andr.io/ch5/ex5_14
Use the `breadthFirst` function to explore a different structure.
Use the `breadthFirst` function to explore a different structure.
betandr/src/andr.io/ch5/ex5_15
Write variadic functions `max` and `min`, analogous to `sum`.
Write variadic functions `max` and `min`, analogous to `sum`.
betandr/src/andr.io/ch5/ex5_16
Write a variadic version of `strings.Join`.
Write a variadic version of `strings.Join`.
betandr/src/andr.io/ch5/ex5_17
Write a variadic function `ElementsByTagName` that, given an HTML node tree and zero or more names, returns all the elements that match one of those names.
Write a variadic function `ElementsByTagName` that, given an HTML node tree and zero or more names, returns all the elements that match one of those names.
betandr/src/andr.io/ch5/ex5_18
Without changing its behavior, rewrite the fetch function to use defer to close the writable file.
Without changing its behavior, rewrite the fetch function to use defer to close the writable file.
betandr/src/andr.io/ch5/ex5_19
Use `panic` and `recover` to write a function that contains no return statement yet returns a non-zero value.
Use `panic` and `recover` to write a function that contains no return statement yet returns a non-zero value.
betandr/src/andr.io/ch5/ex5_2
Change the findlinks program to traverse the `n.FirstChild` linked list using recursive calls to `visit` instead of a loop.
Change the findlinks program to traverse the `n.FirstChild` linked list using recursive calls to `visit` instead of a loop.
betandr/src/andr.io/ch5/ex5_4
Extend the `visit` function so that it extracts other kinds of links from the document, such as images, scripts, and style sheets.
Extend the `visit` function so that it extracts other kinds of links from the document, such as images, scripts, and style sheets.
betandr/src/andr.io/ch5/ex5_5
Implement `countWordsAndImages`.
Implement `countWordsAndImages`.
betandr/src/andr.io/ch5/ex5_6
Surface computes an SVG rendering of a 3-D surface function.
Surface computes an SVG rendering of a 3-D surface function.
betandr/src/andr.io/ch5/ex5_7
Outline prints the outline of an HTML document tree.
Outline prints the outline of an HTML document tree.
betandr/src/andr.io/ch5/ex5_8
Modify `forEachNode` so that the `pre` and `post` functions return a boolean result indicating whether to continue the traversal.
Modify `forEachNode` so that the `pre` and `post` functions return a boolean result indicating whether to continue the traversal.
betandr/src/andr.io/ch5/ex5_9
Write a function `expand(s string, f func(string) string) string` that replaces each substring `$foo` within `s` by the text returned by `f("foo")`.
Write a function `expand(s string, f func(string) string) string` that replaces each substring `$foo` within `s` by the text returned by `f("foo")`.
betandr/src/andr.io/ch6/ex6_1
Implement these additional methods:
Implement these additional methods:
betandr/src/andr.io/ch6/ex6_2
Define a variadic `(*IntSet).AddAll(...int)` method that allows a list of values to be added, such as `s.AddAll(1, 2, 3)`.
Define a variadic `(*IntSet).AddAll(...int)` method that allows a list of values to be added, such as `s.AddAll(1, 2, 3)`.
betandr/src/andr.io/ch6/ex6_3
`(*IntSet).UnionWith` computes the union of two sets using `|`, the word-parallel bitwise OR operator.
`(*IntSet).UnionWith` computes the union of two sets using `|`, the word-parallel bitwise OR operator.
betandr/src/andr.io/ch6/ex6_4
Add a method `Elems` that returns a slice containing the elements of the set, suitable for iterating over with a range loop.
Add a method `Elems` that returns a slice containing the elements of the set, suitable for iterating over with a range loop.
betandr/src/andr.io/ch6/ex6_5
The type of each word used by `IntSet` is `uint64`, but 64-bit arithmetic may be inefficient on a 32-bit platform.
The type of each word used by `IntSet` is `uint64`, but 64-bit arithmetic may be inefficient on a 32-bit platform.
betandr/src/andr.io/ch7/ex7_1
Using the ideas from `ByteCounter`, implement counters for words and for lines.
Using the ideas from `ByteCounter`, implement counters for words and for lines.
betandr/src/andr.io/ch7/ex7_10
The `sort.Interface` type can be adapted to other uses.
The `sort.Interface` type can be adapted to other uses.
betandr/src/andr.io/ch7/ex7_11
Add additional handlers so that clients can create, read, update, and delete database entries.
Add additional handlers so that clients can create, read, update, and delete database entries.
betandr/src/andr.io/ch7/ex7_12
Change the handler for `/list` to print its output as an HTML table, not text.
Change the handler for `/list` to print its output as an HTML table, not text.
betandr/src/andr.io/ch7/ex7_13
Add a `String` method to `Expr` to pretty-print the syntax tree.
Add a `String` method to `Expr` to pretty-print the syntax tree.
betandr/src/andr.io/ch7/ex7_13/eval
Add a `String` method to `Expr` to pretty-print the syntax tree.
Add a `String` method to `Expr` to pretty-print the syntax tree.
betandr/src/andr.io/ch7/ex7_14/eval
Define a new concrete type that satisfies the `Expr` interface and provides a new operation such as computing the minimum value of its operands.
Define a new concrete type that satisfies the `Expr` interface and provides a new operation such as computing the minimum value of its operands.
betandr/src/andr.io/ch7/ex7_15
Write a program that reads a single expression from the standard input, prompts the user to provide values for any variables, then evaluates the expression in the resulting environment.
Write a program that reads a single expression from the standard input, prompts the user to provide values for any variables, then evaluates the expression in the resulting environment.
betandr/src/andr.io/ch7/ex7_15/eval
Define a new concrete type that satisfies the `Expr` interface and provides a new operation such as computing the minimum value of its operands.
Define a new concrete type that satisfies the `Expr` interface and provides a new operation such as computing the minimum value of its operands.
betandr/src/andr.io/ch7/ex7_16
Write a web-based calculator program.
Write a web-based calculator program.
betandr/src/andr.io/ch7/ex7_17
Extend `xmlselect` so that elements may be selected not just by name, but by their attributes too, in the manner of CSS, so that, for instance, an element like `<div id="page" class="wide">` could be selected by matching `id` or `class` as well as its name.
Extend `xmlselect` so that elements may be selected not just by name, but by their attributes too, in the manner of CSS, so that, for instance, an element like `<div id="page" class="wide">` could be selected by matching `id` or `class` as well as its name.
betandr/src/andr.io/ch7/ex7_2
Write a function `CountingWriter` with the signature below that, given an `io.Writer`, returns a new `Writer` that wraps the original, and a pointer to an `int64` variable that any moment contains the number of bytes written to the new `Writer`.
Write a function `CountingWriter` with the signature below that, given an `io.Writer`, returns a new `Writer` that wraps the original, and a pointer to an `int64` variable that any moment contains the number of bytes written to the new `Writer`.
betandr/src/andr.io/ch7/ex7_3
Write a `String` method for the `*tree` type in `gopl.io/ch4/treesort` (§4.4) that reveals the sequence of values in the tree.
Write a `String` method for the `*tree` type in `gopl.io/ch4/treesort` (§4.4) that reveals the sequence of values in the tree.
betandr/src/andr.io/ch7/ex7_3/treesort
Write a `String` method for the `*tree` type in `gopl.io/ch4/treesort` (§4.4) that reveals the sequence of values in the tree.
Write a `String` method for the `*tree` type in `gopl.io/ch4/treesort` (§4.4) that reveals the sequence of values in the tree.
betandr/src/andr.io/ch7/ex7_4
The `strings.NewReader` function returns a value that satisfies the `io.Reader` interface (and others) by reading from its argument, a string.
The `strings.NewReader` function returns a value that satisfies the `io.Reader` interface (and others) by reading from its argument, a string.
betandr/src/andr.io/ch7/ex7_5
The `LimitReader` function in the `io` package accepts an `io.Reader r` and a number of bytes `n`, and returns another `Reader` that reads from `r` but reports an end-of-file condition after `n` bytes.
The `LimitReader` function in the `io` package accepts an `io.Reader r` and a number of bytes `n`, and returns another `Reader` that reads from `r` but reports an end-of-file condition after `n` bytes.
betandr/src/andr.io/ch7/ex7_6
Add support for Kelvin temperatures to `tempFlag`.
Add support for Kelvin temperatures to `tempFlag`.
betandr/src/andr.io/ch7/ex7_6/tempconv
Add support for Kelvin temperatures to `tempFlag`.
Add support for Kelvin temperatures to `tempFlag`.
betandr/src/andr.io/ch7/ex7_8
Many GUIs provide a table widget with a stateful multi-tier sort: the primary sort key is the most recently clicked column head, the secondary sort key is the second most clicked column head, and so on.
Many GUIs provide a table widget with a stateful multi-tier sort: the primary sort key is the most recently clicked column head, the secondary sort key is the second most clicked column head, and so on.
betandr/src/andr.io/ch7/ex7_9
Use the `html/template` package (§4.6) to replace `printTracks` with a function that displays the tracks as an HTML table.
Use the `html/template` package (§4.6) to replace `printTracks` with a function that displays the tracks as an HTML table.
betandr/src/andr.io/ch8/ex8_1/clock2
Modify `clock2` to accept a port number, and write a program, `clockwall`, that acts as a client of clock servers at once, reading the times from each one and displaying the results in a table, akin to the wall of clocks seen in some business offices.
Modify `clock2` to accept a port number, and write a program, `clockwall`, that acts as a client of clock servers at once, reading the times from each one and displaying the results in a table, akin to the wall of clocks seen in some business offices.
betandr/src/andr.io/ch8/ex8_1/clockwall
Modify `clock2` to accept a port number, and write a program, `clockwall`, that acts as a client of clock servers at once, reading the times from each one and displaying the results in a table, akin to the wall of clocks seen in some business offices.
Modify `clock2` to accept a port number, and write a program, `clockwall`, that acts as a client of clock servers at once, reading the times from each one and displaying the results in a table, akin to the wall of clocks seen in some business offices.
betandr/src/andr.io/ch8/ex8_2
Implement a concurrent File Transfer Protocol (FTP) server.
Implement a concurrent File Transfer Protocol (FTP) server.
betandr/src/andr.io/ch8/ex8_3
In `netcat3`, the interface value `conn` has the concrete type `*net.TCPConn`, which represents a TCP connection.
In `netcat3`, the interface value `conn` has the concrete type `*net.TCPConn`, which represents a TCP connection.
betandr/src/andr.io/ch8/ex8_4
Modify the `reverb2` server to use a `sync.WaitGroup` per connection to count the number of active echo goroutines.
Modify the `reverb2` server to use a `sync.WaitGroup` per connection to count the number of active echo goroutines.
garymacindoe/src/garymacindoe.co.uk/ch1/ex1_10
Fetchall fetches URLs in parallel and reports their times and sizes.
Fetchall fetches URLs in parallel and reports their times and sizes.
garymacindoe/src/garymacindoe.co.uk/ch1/ex1_4
Dup2 prints the count and text of lines that appear more than once in the input.
Dup2 prints the count and text of lines that appear more than once in the input.
garymacindoe/src/garymacindoe.co.uk/ch1/ex1_5
Lissajous generates GIF animations of random Lissajous figures.
Lissajous generates GIF animations of random Lissajous figures.
garymacindoe/src/garymacindoe.co.uk/ch1/ex1_6
Lissajous generates GIF animations of random Lissajous figures.
Lissajous generates GIF animations of random Lissajous figures.
garymacindoe/src/garymacindoe.co.uk/ch1/ex1_7
Fetch prints the content found at each specified URL.
Fetch prints the content found at each specified URL.
garymacindoe/src/garymacindoe.co.uk/ch1/ex1_8
Fetch prints the content found at each specified URL.
Fetch prints the content found at each specified URL.
garymacindoe/src/garymacindoe.co.uk/ch1/ex1_9
Fetch prints the content found at each specified URL.
Fetch prints the content found at each specified URL.
garymacindoe/src/garymacindoe.co.uk/ch2/cf
Cf converts its numeric argument to Celsius, Fahrenheit, Feet, Metres, Pounds and Kilograms.
Cf converts its numeric argument to Celsius, Fahrenheit, Feet, Metres, Pounds and Kilograms.
garymacindoe/src/garymacindoe.co.uk/ch2/lengthconv
Package lengthconv performs Feet and Meters conversions.
Package lengthconv performs Feet and Meters conversions.
garymacindoe/src/garymacindoe.co.uk/ch2/tempconv
Package tempconv performs Celsius, Fahrenheit and Kelvin conversions.
Package tempconv performs Celsius, Fahrenheit and Kelvin conversions.
garymacindoe/src/garymacindoe.co.uk/ch2/weightconv
Package weightconv performs pounds and kilograms conversions.
Package weightconv performs pounds and kilograms conversions.
garymacindoe/src/garymacindoe.co.uk/ch3/surface
Surface computes an SVG rendering of a 3-D surface function.
Surface computes an SVG rendering of a 3-D surface function.
garymacindoe/src/garymacindoe.co.uk/mandelbrot
Mandelbrot emits a PNG image of the Mandelbrot fractal.
Mandelbrot emits a PNG image of the Mandelbrot fractal.
kodjobaah/src/chapter1/10-11
Fetchall fetches URLs in parallel and reports their times and sizes
Fetchall fetches URLs in parallel and reports their times and sizes
kodjobaah/src/chapter1/12
Generates GIF animations of random Lissajous figures.
Generates GIF animations of random Lissajous figures.
kodjobaah/src/chapter1/4
Dup2 prints the count and text of lines that appear more than once in the input.
Dup2 prints the count and text of lines that appear more than once in the input.
kodjobaah/src/chapter1/5-6
Lissajous generates GIF animations of random Lissajous figures.
Lissajous generates GIF animations of random Lissajous figures.
kodjobaah/src/chapter1/7-9
Fetch prints the content found at each specified url
Fetch prints the content found at each specified url
kodjobaah/src/chapter2/ex1/tempConv
Package tempconv performs Celsius and Fahrenheit conversions
Package tempconv performs Celsius and Fahrenheit conversions
kodjobaah/src/chapter2/ex2
General Purpose unit conversion application
General Purpose unit conversion application
kodjobaah/src/chapter2/ex3_5/popcount
reference used for popcount: https://arxiv.org/pdf/1611.07612.pdf another useful reference: https://graphics.stanford.edu/~seander/bithacks.html
reference used for popcount: https://arxiv.org/pdf/1611.07612.pdf another useful reference: https://graphics.stanford.edu/~seander/bithacks.html
kodjobaah/src/chapter3/ex1
Surface computes an SVG rendering of a 3-D surface function
Surface computes an SVG rendering of a 3-D surface function
kodjobaah/src/chapter3/ex10
Non recursive comma insertion
Non recursive comma insertion
kodjobaah/src/chapter3/ex13
Taken from https://github.com/golang/go/wiki/Iota
Taken from https://github.com/golang/go/wiki/Iota
kodjobaah/src/chapter3/ex4
Server2 is a minimal "echo" and counter server
Server2 is a minimal "echo" and counter server
kodjobaah/src/chapter3/ex5
Mandelbrot emits a PNG image of the Mandelbrot fractal
Mandelbrot emits a PNG image of the Mandelbrot fractal
kodjobaah/src/chapter4/charcount
Charcount computes counts of Unicode characters
Charcount computes counts of Unicode characters
kodjobaah/src/chapter4/ex10
Issues prints a table of GitHub issues matching the search terms.
Issues prints a table of GitHub issues matching the search terms.
kodjobaah/src/chapter4/ex3
reverse reverses a slice of ints in place
reverse reverses a slice of ints in place
kodjobaah/src/chapter4/ex8
Charcount computes counts of Unicode characters
Charcount computes counts of Unicode characters
kodjobaah/src/chapter4/github
Package github provides a GO API for the GitHub issue tracker.
Package github provides a GO API for the GitHub issue tracker.
kodjobaah/src/chapter4/issues
Issues prints a table of GitHub issues matching the search terms.
Issues prints a table of GitHub issues matching the search terms.
kodjobaah/src/chapter4/nonempty
Nonempty is an example of an in-place slice algorithm
Nonempty is an example of an in-place slice algorithm
kodjobaah/src/chapter4/rev
reverse reverses a slice of ints in place
reverse reverses a slice of ints in place

Jump to

Keyboard shortcuts

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