Directories ¶
Path | Synopsis |
---|---|
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. |
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`. |
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. |
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. |
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`. |
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. |
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. |
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. |
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`. |
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. |
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`. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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). |
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. |
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. |
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. |
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. |
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. |
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'). |
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. |
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`. |
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. |
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`. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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`. |
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. |
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. |
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. |
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`. |
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. |
andr.io/ch5/ex5_14
Use the `breadthFirst` function to explore a different structure.
|
Use the `breadthFirst` function to explore a different structure. |
andr.io/ch5/ex5_15
Write variadic functions `max` and `min`, analogous to `sum`.
|
Write variadic functions `max` and `min`, analogous to `sum`. |
andr.io/ch5/ex5_16
Write a variadic version of `strings.Join`.
|
Write a variadic version of `strings.Join`. |
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. |
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. |
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. |
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. |
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. |
andr.io/ch5/ex5_5
Implement `countWordsAndImages`.
|
Implement `countWordsAndImages`. |
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. |
andr.io/ch5/ex5_7
Outline prints the outline of an HTML document tree.
|
Outline prints the outline of an HTML document tree. |
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. |
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")`. |
andr.io/ch6/ex6_1
Implement these additional methods:
|
Implement these additional methods: |
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)`. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
andr.io/ch7/ex7_16
Write a web-based calculator program.
|
Write a web-based calculator program. |
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. |
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`. |
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. |
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. |
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. |
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. |
andr.io/ch7/ex7_6
Add support for Kelvin temperatures to `tempFlag`.
|
Add support for Kelvin temperatures to `tempFlag`. |
andr.io/ch7/ex7_6/tempconv
Add support for Kelvin temperatures to `tempFlag`.
|
Add support for Kelvin temperatures to `tempFlag`. |
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. |
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. |
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. |
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. |
andr.io/ch8/ex8_2
Implement a concurrent File Transfer Protocol (FTP) server.
|
Implement a concurrent File Transfer Protocol (FTP) server. |
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. |
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. |
Click to show internal directories.
Click to hide internal directories.