Errata

Learning Go

Errata for Learning Go

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Other Digital Version Chapter 4, section "The Complete for Statement"
3rd Paragraph

"The if statement has three parts, separated by semicolons." It should be "The for statement has three parts, separated by semicolons."

Anonymous  Apr 27, 2024 
Other Digital Version The Complete for Statement
5th paragraph

In the iBooks version, just purchased this week.

The text says

`You usually see something like i{plus}{plus} here`

Blair Zajac  Jul 22, 2024 
Other Digital Version Iterating over strings, example 4-16
In the code sample itself and the sample output

In the iBooks version reading on my iPad, this line

samples := []string{"hello", "apple_π!"}

and in this section:

0 97 a
1 112 p
2 112 p
3 108 l
4 101 e
5 95 _
6 960 π
8 33 !

the `π` looks like a normal n, presumably due to the font being used. In the main text this looks fine: `“Looking at the result for “apple_π!” is more interesting:`

Switching the `π` out for an emoji would make the reading much clearer for non-body text.

Blair Zajac  Jul 22, 2024 
Page 1
Table of contents

Entire table of contents is wrong online version.

Note from the Author or Editor:
Can you be more clear? I have clicked through the table of contents online and it seems to be correct, although sometimes it doesn't scroll to quite the right spot.

Stan  Jul 18, 2021 
PDF Page 3
3rd Paragraph

setx GOPATH %USERPROFILE%\go
setx path "%path%;%USERPROFILE%\bin"

In the second line, the correct line should be like this:
setx path "%path%;%GOPATH%\bin

Anonymous  Feb 05, 2024 
PDF Page 28
linting concept in the page

Dear Sir,

The book OREILLY Learning Go really helped me in learning the concepts, but I found the tool go lint is deprecated in the beginning of 2021 and it needs corrections in the next edition of Learning Go book. remove the complete concept on go lint mentioned in this book as it will not work on existing code. reference page number - 28 and 29 some lines of the book.
sending these details so that it will help the author for further corrections. :)

reference link - https://pkg.go.dev/golang.org/x/lint#section-readme

VIVEK S  Jun 14, 2022 
Printed Page 61
Second "general note"

"...This doesn't mean that Go doesn't have some of the features of object-oriented languages it just does things a little differently."

After, "languages", there should be either a period or a semi-colon (the latter being, IMO, the better choice):

"...This doesn't mean that Go doesn't have some of the features of object-oriented languages[;] it just does things a little differently."

Rhys Mahannah  Jun 05, 2024 
PDF Page 76
Note in the bottom

You use the word "compound types" in chapters 4, 7, 15, and 16, and you use the word "composite types" in chapters 2 and 3.

"The Go Programming Language Specification" (go.dev/ref/spec) uses the word "composite types" but does not use the word "compound types."

I imagine you use the words interchangeably.
I think it is better NOT to use the word "compound types" in the book.
It is confusing. Especially, non-native English speakers (like me) might think that "composite types" and "compound types" are different.

Anonymous  May 13, 2024 
Printed Page 85
2nd paragraph

In the second paragraph:

"I'll go over the features of the `switch` statement to explain the output. As is the case with `if` statements, you don't put parentheses around the value being compared in a `switch`. Also as if an `if` statement..."

In that last sentence, should that read, "Also, as with an `if` statement, ..."? Should "if" be replaced with "with"? And should a comma come after "Also"?

Rhys Mahannah  Jun 05, 2024 
Printed Page 144 -- The "General Note"
Fourth sentence

"This means that tthe [sic] type has a specified way..."

"tthe" should be "the"

Rhys Mahannah  Jun 09, 2024 
152
3rd paragraph

The text mentions an interface but the code uses a different one. Here the text mentions io.Writer implements io.WriterTo and io.Reader implements io.ReaderFrom. But the code uses the other way around. src which is an instance of io.Reader is checked for WriterTo and dst which is an instance of io.Writer is checked for ReaderFrom.

"This function has two parameters of types io.Writer
and io.Reader and calls the io.copyBuffer function to do its work. If the io.Writer
parameter also implements io.WriterTo, or the io.Reader parameter also implements
io.ReaderFrom, most of the work in the function can be skipped:"
func copyBuffer(dst Writer, src Reader, buf []byte) (written int64, err error) {
// If the reader has a WriteTo method, use it to do the copy.
// Avoids an allocation and a copy.
if wt, ok := src.(WriterTo); ok {
return wt.WriteTo(dst)
}
// Similarly, if the writer has a ReadFrom method, use it to do the copy.
if rt, ok := dst.(ReaderFrom); ok {
return rt.ReadFrom(src)
}

Anonymous  Jun 03, 2022 
PDF Page 158
Under Interfaces Are Type-Safe Duck Typing, first paragraph, last sentence

Extra word 'that' in last sentence.

Reads: 'Therefore, that the concrete type can be assigned to a variable or field declared to be of the type of the interface.'

I believe this should be: 'Therefore, the concrete type can be assigned to a variable or field declared to be of the type of the interface.'

onyx  Sep 04, 2024 
PDF Page 181
Under Generics Reduce Repetitive Code and Increase Type Safety, fifth sentence

Extra word 'when'

reads: 'This strictness enables the compiler to help validate that your code is correct, but sometimes when you’ll want to reuse the logic in a function or the fields in a struct with different types.'

Suggestion: 'but sometimes you’ll want to reuse the logic'

onyx  Sep 06, 2024 
PDF Page 196
Under More on comparable, first sentence

Missing space between words

Reads:
'As you saw in “Interfaces Are Comparable” on page 165, interfacesare one of the'

Suggestion: Needs space between words interfaces and are.

onyx  Sep 07, 2024 
Printed Page 291
Fourth paragraph under the "Reading, Writing, and Buffering" subtitle

A very minor edit, but the following sentence:

"A single goroutine rarely reads and writes to the same channel."

Could be more accurately written as follows:

"A single goroutine rarely reads [from] and writes to the same channel.

Rhys Mahannah  Jun 10, 2024 
PDF Page 380
Under Running Table Tests, the example code DoMath function, case '*'

The "*" case for the DoMath function currently returns num1 + num2, nil

It should return num1 * num2, nil

onyx  Sep 19, 2024