Errata

Powerful Command-Line Applications in Go

Errata for Powerful Command-Line Applications in 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
O'Reilly learning platform Page Writing Tests for colStats
Code block for performance/colStats/csv_test.go defining csvData

The code block defining the `csvData` is as follows:

```go
csvData := `IP Address,Requests,Response Time
192.168.0.199,2056,236
192.168.0.88,899,220
192.168.0.199,3054,226
192.168.0.100,4133,218
192.168.0.199,950,238
`

The issue is the last newline. Tests will fail with a panic, "wrong number of fields", because the CSV reader sees that final row with nothing in it.

The data should look like this:

```go
csvData := `IP Address,Requests,Response Time
192.168.0.199,2056,236
192.168.0.88,899,220
192.168.0.199,3054,226
192.168.0.100,4133,218
192.168.0.199,950,238`
```

Jamey Nakama  Jan 20, 2024