Go言語プログラミングエッセンス

サポートページ

この記事を読むのに必要な時間:およそ 0.5 分

お詫びと訂正(正誤表)

本書の以下の部分に誤りがありました。ここに訂正するとともに,ご迷惑をおかけしたことを深くお詫び申し上げます。

(2024年1月22日最終更新)

P.38 下から5行目

mapは順を持たないキーと値のペアです。
mapは順を持たないキーと値のペアです。

(以下2024年1月9日更新)

P.232 1行目

$ ./main -t 2022-11-26T08:23:05Z07:00
$ ./main -t 2022-11-26T08:23:05+09:00

(以下2023年12月13日更新)

P.45 本文4行目

underling type
underlying type

P.314 索引「U」の項目1つめ

underling type
underlying type

(以下2023年9月25日更新)

P.224  リスト9.19のキャプション

TestFindEntrieの変更個所
TestFindEntriesの変更個所

P.224  リスト9.20 のキャプション

最終的なTestFindEntrieの実装
最終的なTestFindEntriesの実装

(以下2023年4月21日更新)

P.14 4行目

それ意外はlibcに依存しません。
それ以外はlibcに依存しません。

(以下2023年4月10日更新)

P.57 本文2行目

「one two hree」
「one two three」

P.114

.
├── cmd
│     └── awesome
│         ├── awesome
│         └── main.go
.
├── cmd
│     └── awesome
│         └── main.go

※「cmd/awesome/awesome」が余計でした。

(以下2023年4月5日更新)

P.64 端末画面

$ go mod tidy -replace github.com/mattn/foobar=..
$ go mod tidy -replace github.com/mattn/foobar=../

P.64 リスト最終行

replace github.com/mattn/blahblah => ..
replace github.com/mattn/foobar => ../

P.64 本文6行目

examplesで使われているblahblahは、github.com/mattn/blahblahからではなく
examplesで使われているfoobarは、github.com/mattn/foobarからではなく

P.206 リスト9.1 15行目

InfoURL string
SiteURL string

P.209 リスト9.7 7行目

author := doc.Find("table[summary=作家データ] tr:nth-child(1) td:nth-child(2)").Text()
author := doc.Find("table[summary=作家データ] tr:nth-child(2) td:nth-child(2)").First().Text()

P.210 リスト9.8 8行目

author := doc.Find("table[summary=作家データ]:nth-child(1) tr:nth-child(2) td:nthchild(2)").Text()
author := doc.Find("table[summary=作家データ] tr:nth-child(2) td:nth-child(2)").First().Text()

※「nth-child(1) 」が余計でした。

P.228 リスト9.22 9行目

name := flag.String("name", "somthing", "my name")
name := flag.String("name", "something", "my name")

P.229 1つめの端末画面 6行目

my name (default "somthing")
my name (default "something")

P.229 本文5~6行目

time.Duratoinがあります。
time.Durationがあります。

P.250 2つめのリスト 8行目

t.user_id = u.id
t.id = u.id

(以下2023年3月30日更新)

P.212 8行目

findZipURLやfindEntriesを試験したくなった際には、
findAuthorAndZIPやfindEntriesを試験したくなった際には、

P.213 本文1行目

bytes.NewReaderを使ってZIPファイルを読み込みます。
zip.NewReaderを使ってZIPファイルを読み込みます。

P.221 表9.4 データベース照会プログラムの仕様

aozora-search artists
aozora-search authors

(以下2023年3月28日更新)

P.59 リスト3.12 下から13行目

for _, b := range ch {
for b := range ch {

※「_,」が余計でした。

P.150 リスト6.4 下から13行目

for _, b := range ch {
    r:=csv.NewReaderでbytes.NewReader(r))
for b := range ch {
    r:=csv.NewReaderでbytes.NewReader(b))

※「_,」が余計でした。

(以下2023年3月27日更新)

P.80 リスト4.5 9行目

func (i Fluit) String() string {
func (i Fruit) String() string {

P.81 本文3行目

fluit.go
fruit.go

P.81 本文4行目

Fluit
Fruit

P.153 リスト6.7 15行目

// fanIn is itself a generator
// fanInはそれ自体のジェネレータ

P.153 リスト6.7 16行目

// receives two read-only channels
// 2つの読み取り専用channelから読み取り

P.154 リスト6.7 12行目

// returns receive-only channel
// 受信専用channelを返す

P.154 リスト6.7 14行目

// anonymous goroutine
// 匿名関数goroutine

P.155 リスト6.8 12行目

// returns receive-only channel
// 受信専用channelを返す

P.155 リスト6.8 23行目

// anonymous goroutine
// 匿名関数goroutine

P.156 リスト6.9 11行目

// returns receive-only channel
// 受信専用channelを返す

P.156 リスト6.9 13行目

// anonymous goroutine
// 匿名関数goroutine

P.157 リスト6.10 13行目

// returns receive-only channel
// 受信専用channelを返す

P.157 リスト6.10 15行目

// anonymous goroutine
// 匿名関数goroutine

P.157 リスト6.10 19行目

// nothing
// 何もしない

P.158 リスト6.11 3行目

// returns receive-only channel
// 受信専用channelを返す

P.158 リスト6.11 5行目

// anonymous goroutine
// 匿名関数goroutine

P.158 リスト6.11 9行目

// nothing
// 何もしない

P.217 1つめのコード7行目

res, err = db.Exec(`INSERT INTO contents(author_id, title_id, title, content) values(?, ?, ?, ?)`,
    "000879",
    "14",
    "あばばばば",
    content,
)
if err != nil {
    log.Fatal(err)
}
res, err := db.Exec(`INSERT INTO authors(author_id, author) values(?, ?)`,
    "000879",
    "芥川竜之介",
)
if err != nil {
    log.Fatal(err)
}
res, err = db.Exec(`INSERT INTO contents(author_id, title_id, title, content) values(?, ?, ?, ?)`,
    "000879",
    "14",
    "あばばばば",
    content,
)
if err != nil {
    log.Fatal(err)
}

奥付ページ

https://gihyo.jp/book/2022/978-4-297-13419-8/support
https://gihyo.jp/book/2023/978-4-297-13419-8/support

(以下2023年3月22日更新)

本文全体

Goland
GoLand

P.15

Pythonで言うvenv
Pythonで言うpyenv

P.83 リスト4.7 24行目

type Data struct {
    Species string    `json:"species"`
    Description string    `json:"description"`
    Dimensions Dimensions    `json:"dimensions"`
}
type Data struct {
    Species string           `json:"species"`
    Description string       `json:"description"`
    Dimensions Dimensions    `json:"dimensions"`
}

※インデントがずれていました。

P.40 4つめのコード

type MyString stirng
type MyString string

(以下2023年3月20日更新)

P.167 リスト7.4 16行目

{name: "rhs is shorter than rhs", lhs: "fo", rhs: "foo", want: -1},
{name: "lhs is shorter than rhs", lhs: "fo", rhs: "foo", want: -1},

P.197 本文3行目

graphvis
graphviz

(以下2023年3月17日更新)

P.294 リスト12.8 8行目

err := db.Schema.Create(context.Background()
err := db.Schema.Create(context.Background())

(以下2023年3月14日更新)

P.39 3つめのコード5行目

fmt.Println(m) // map[Bob:2 John:1 Mark:3]が表示される
fmt.Println(m) // map[Bob:18 John:21 Mark:33]が表示される

P.84 3つめのコード

var data Data
dec := json.NewDecoder(f)
scanner := bufio.NewScanner(conn)
for scanner.Scan() {
    line := scanner.Text()
    // 行ごとにJSONをデコード
    err := dec.Decode(&data)
    if err != nil {
        break
    }
    doSomething(&data)
}
var data Data
dec := json.NewDecoder(f)
for {
    err := dec.Decode(&data)
    if err != nil {
        break
    }
    doSomething(&data)
}

P.99 下から11行目

windowsかつ386
windowsまたは386

P.119 2行目

シュガーになっています
シンタックスシュガーになっています

P.234~235 端末画面

COMMANDS:
    list list students
    help, h Shows a list of commands or help for one command
COMMANDS:
    help, h Shows a list of commands or help for one command

※listからはじまる行が余計でした。

P.237 2つめの端末画面

"Go言語 好き太郎 golang@example.com>"
"Go言語 好き太郎 <golang@example.com>"

P.237 2つめのコード3行目

Go言語 好き太郎 golang@example.com>
Go言語 好き太郎 <golang@example.com>

(以下2023年3月13日更新)

P.42 1つめのコード2行目

user.wName
user.Name

「w」が余計でした。

P.89 1つめのコード5~6行目

if err != nil {
     log.Fatal(err) // 4m0s
}
fmt.Println(d)
if err != nil {
     log.Fatal(err)
}
fmt.Println(d) // 4m0s

P.168 7行目

Deve Cheney
Dave Cheney

P.205 1つめの端末画面下の注記

ご自身のGitHubに置き換え
ご自身のGitHubユーザ名に置き換え

P.274 本文2行目

Distanc
Distance