This is the official source code repository for the book. You are welcome to browse this repository and use the issues tab to report any problems or ask any questions.
- Feel free to copy and paste from the repository where appropriate, although typing the code out will surely do more for the learning experience
- If you are enjoying the book, please tell others by reviewing the book on Amazon
- From Amazon.com
- Free articles about Go in the real world: https://medium.com/@matryer
Throughout the book many projects, programs and packages are developed, including:
- Chat application web application that lets people have conversations in their browsers.
- Tracer package package that provides tracing capabilities for Go programs. Built for illustration purposes, in production environments consider using log.Logger from the standard library instead.
- Domain finder program that helps you find the perfect domain name for your projects, including whether they're available or not. Depends on a series of subprograms that do its bidding.
- Thesaurus package that provides an interface and an implementation for Big Huge Thesaurus that allows you to lookup synonyms of words.
- Meander package that provides random event recommendations with associated web application
- Backup program for periodically backing up your source code.
Each chapter has its own section which it is recommended that you read before embarking on the chapter itself, as updates, tweaks, bug fixes, additional notes and tips will be outlined here.
- Browse the Source code
- If you're getting some kind of
version != 13
error, you may want to read towards the bottom of this issue
- Browse the Source code
Notes:
- Page 53:
w.Header.Set
should bew.Header().Set
sinceHeader
is a function onhttp.ResponseWriter
.
- Browse the Source code
Notes:
- Page 81: For Gravatar to work, you need to hash the email address, not the user's name:
io.WriteString(m, strings.ToLower(user.Email()))
- Thanks @lozandier
Other minor things:
- Page 78: Autocompleted typo:
gravatarAvitar
should begravatarAvatar
- you can name your variables anything you like, but it's nice for them to be spelled correctly. - Thanks @lozandier - Page 83: The HTML
<label>
is not properly attached to the associated<input>
- View Diff - Thanks @crbrox
- Browse the Source code
Notes:
- BigHuge is mistyped in a few places as BigHugh. I don't know who Big Hugh is, but I'm sure he's very nice. Either way, he's a little unwelcome in Chapter 4, so you should consistently type big HUGE - Thanks @OAGr
- Page 112: Sometimes
data.Noun
anddata.Verb
arenil
, which causes a panic. Make your code a little more bulletproof by first checking if they're== nil
before trying to access theSyn
field. See Issue #11 for a solution. Thanks @OAGr
- Browse the Source code
Notes:
- There's a data-race with the way I call
updater.Reset
from within the function. Read more about it here.
- Struct tags are written like this:
json:"title"
- Browse the Source code
- Browse the Source code
- Browse the Source code
- Browse the Source code