Errata

Cloud Native Go

Errata for Cloud Native 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
ePub Page 000
Chapter 5,Implementing the create function, first code block, Line 7

On Learning Oreilly the are no page numbers, so I used 000.

In line 7:
io.ReadAll(r.Body)

Should be:
ioutil.ReadAll(r.Body)

Martin Dehnert  May 29, 2021 
000
Chapter 5,Implementing the read function, dotted list

No Pagenumer on Safari Books online, so 000.

first item in list:
/v1/key/{key}

should be:
/v1/{key}

Martin Dehnert  May 29, 2021 
000
Chapter 5, ReadEvents code, Line 15

No page numbers on Safari Online, so I used 000.
line 15:
if err := fmt.Sscanf(line, "%d\t%d\t%s\t%s"

should by like:
if _, err := fmt.Sscanf(line, "%d\t%d\t%s\t%s"

Martin Dehnert  May 30, 2021 
000
000 Chapter 5, ReadEvents code, Line 15

No page numbers on Safari Online, so I used 000.
from line 15:
if err := fmt.Sscanf(line, "%d\t%d\t%s\t%s",
&e.Sequence, &e.EventType, &e.Key, &e.Value); err != nil {

outError <- fmt.Errorf("input parse error: %w", err)
return
}
even in the corrected form:
if _,err := fmt.Sscanf(line, "%d\t%d\t%s\t%s",
&e.Sequence, &e.EventType, &e.Key, &e.Value); err != nil {

outError <- fmt.Errorf("input parse error: %w", err)
return
}

The code bails out on the first line with a DELETE command in the transaction log because an empty string at the end of the line does not match '%s'.
The code from the books Github repository is working because it does not check for errors.

Martin Dehnert  May 31, 2021 
PDF

I don't remember the location of the following function. The problem is that using unbuffered channels results with a goroutine and channels leak:

type SlowFunction func(string) (string, error)

type WithContext func(context.Context, string) (string, error)

func Timeout(f SlowFunction) WithContext {
return func(ctx context.Context, arg string) (string, error) {
chres := make(chan string, 1) // 3. But making the channels buffered, we let the
// goroutine send without blocking. Problem solved :)
cherr := make(chan error, 1)
go func() {
res, err := f(arg)
chres <- res // 2. `f` has finally returned, and we're trying to
// send to the channel, but no one is receiving from it
// because we have already exited the select.
// As a result, the goroutine is blocked forever on this line,
// causing a leak of: the goroutine, the `chres` and `cherr`
// channels.
cherr <- err
log.Println("got!!!")
}()
select {
case res := <-chres:
return res, <-cherr
case <-ctx.Done(): // 1. `f` has not returned in time, so the context expired
return "", ctx.Err()
}
}
}

Vasily Kirichenko  Nov 15, 2021 
Other Digital Version Chapter 1 > Resilience
2nd paragraph

There is a repetition of the words "the other" in the following: When we discuss resilience (and the other the other “cloud native attributes” as well, but especially when we discuss resilience)

Bruno Gmail  Feb 04, 2022 
chapter3, "Simple Numbers" section
4th Paragraph

rune is an alias of int32 but it has been mentioned as uint32. Please correct.

Mark Caleb  Dec 24, 2022 
ePub Page Page 131, Storing State in a Transaction Log
ReadEvents method code

This line is not correct, fmt.Sscanf return (n int, err Error)

if err := fmt.Sscanf(line, "%d\t%d\t%s\t%s",

to make the code compile, it should look like this

if _, err := fmt.Sscanf(line, "%d\t%d\t%s\t%s",

Jürgen De Commer  Dec 29, 2023 
Printed Page 5
last sentence on page

sentence ends with "Service A is a transitive upstream dependency of Service A." From the preceding sentences, looks like it was intended to read "Service A is a transitive upstream dependency of Service C."

Cameron Tully-Smith  Jun 01, 2021 
PDF Page 5
Upstream and Downstream Explanation

On page number 5 where Upstream and Downstream dependencies are explained, I think there is a mistake. The explanations for upstream and downstream seem to be swapped around.

Anonymous  Jan 02, 2023 
Printed Page 36
Container type description

The print says ArrayArray is a container type, where it should simply say Array

Anonymous  Jan 12, 2023 
Printed Page 56
Last paragraph

The book says 'When we call incrementor' while the function is called incrementer

Anonymous  Jan 12, 2023 
Printed Page 136
First line

Should it be an initialisation function not a method?

Michael Shearer  Jun 02, 2021 
Printed Page 149
1st code block

Should the ListenAndServeTLS call have r as final parameter not nil?

Michael Shearer  Jun 02, 2021 
Printed Page 158
1st code block

To copy multiple files in Dockerfile the destination needs to end with /

COPY *.pem ./

Michael Shearer  Jun 02, 2021 
Printed Page 224
7th paragraph

Two messaging patterns are listed: request-response (synchronous), and publish-subscribe (asynchronous). It states both have pros and cons. The next subsection is about 'request-response messaging', but I'm missing the section about 'publish-subscribe'. I expected some text on communication using asynchronous messaging, as this is a big thing in the way micro-services communicate nowadays.

Jop van Raaij  Jun 19, 2022 
Printed Page 232
2nd code block

To generate grpc protoc file I needed to:

go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc

Michael Shearer  Jun 03, 2021 
Printed Page 240
End of code block

Log fatal syntax prompt should say ‘Syntax: go run . [get|put] KEY VALUE

Michael Shearer  Jun 03, 2021