Skip to content

Commit 56ecdcd

Browse files
Merge pull request #47 from budougumi0617/apply-feedback
discussionsで頂いた指摘を反映
2 parents ec8be28 + 29d2398 commit 56ecdcd

File tree

6 files changed

+71
-6
lines changed

6 files changed

+71
-6
lines changed

_chapter18/section74/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
TODO_DB_PORT: 3306
1414
TODO_DB_USER: todo
1515
TODO_DB_PASSWORD: todo
16-
TODO_DB_DATABASE: todo
16+
TODO_DB_NAME: todo
1717
volumes:
1818
- .:/app
1919
ports:

_chapter19/section75/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
TODO_DB_PORT: 3306
1414
TODO_DB_USER: todo
1515
TODO_DB_PASSWORD: todo
16-
TODO_DB_DATABASE: todo
16+
TODO_DB_NAME: todo
1717
volumes:
1818
- .:/app
1919
ports:

_chapter19/section78/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
TODO_DB_PORT: 3306
1414
TODO_DB_USER: todo
1515
TODO_DB_PASSWORD: todo
16-
TODO_DB_DATABASE: todo
16+
TODO_DB_NAME: todo
1717
volumes:
1818
- .:/app
1919
ports:

_chapter19/section79/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
TODO_DB_PORT: 3306
1414
TODO_DB_USER: todo
1515
TODO_DB_PASSWORD: todo
16-
TODO_DB_DATABASE: todo
16+
TODO_DB_NAME: todo
1717
volumes:
1818
- .:/app
1919
ports:

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ services:
1313
TODO_DB_PORT: 3306
1414
TODO_DB_USER: todo
1515
TODO_DB_PASSWORD: todo
16-
TODO_DB_DATABASE: todo
16+
TODO_DB_NAME: todo
1717
TODO_REDIS_HOST: todo-redis
1818
TODO_REDIS_PORT: 6379
1919
volumes:

errata.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,40 @@ mux.Post("/register", ru.ServeHTTP)
101101
`WriteHeader`メソッド内の「`r.status = status`」を「`r.status = statusCode`」に修正。
102102
[@litencatt](https://github.com/litencatt)さん[ご指摘](https://github.com/budougumi0617/go_todo_app/discussions/33) ありがとうございました(2022/08/15)
103103

104+
104105
**P148 テストとコードカバレッジ取得の自動実行**
105106
「GitHub Actiuons上で実行したテスト結果」ではなく、「GitHub Actions上で実行したテスト結果」に修正。
106107
[@kdnakt](https://twitter.com/kdnakt)さんご指摘ありがとうございました(2022/08/06)
107108

109+
**P148 テストとコードカバレッジ取得の自動実行**
110+
`.github/workflows/`ディレクトリ配下に`test.yml`を作成します。」ではなく、「`.github/workflows/`ディレクトリ配下に`test.yml`を作成します。また、ルートディレクトリに`.octocov.yml`を作成します」に修正。
111+
`.octocov.yml`のファイル内容は次のとおりです。
112+
https://github.com/budougumi0617/go_todo_app/blob/v1.0.4/.octocov.yml
113+
```yaml
114+
coverage:
115+
paths:
116+
- coverage.out
117+
codeToTestRatio:
118+
code:
119+
- '**/*.go'
120+
- '!**/*_test.go'
121+
test:
122+
- '**/*_test.go'
123+
testExecutionTime:
124+
if: true
125+
diff:
126+
datastores:
127+
- artifact://${GITHUB_REPOSITORY}
128+
comment:
129+
if: is_pull_request
130+
report:
131+
if: is_default_branch
132+
datastores:
133+
- artifact://${GITHUB_REPOSITORY}
134+
```
135+
136+
[@ac0mz](https://github.com/ac0mz)さん[ご指摘](https://github.com/budougumi0617/go_todo_app/discussions/43) ありがとうございました(2022/09/04)
137+
108138
109139
**P163 リスト16.16 「httptest」パッケージを使った擬似的なHTTPリクエストのテスト**
110140
`{"status": " ok"}`」ではなく、「`{"status": "ok"}`」に修正。
@@ -134,6 +164,10 @@ if err != nil {
134164
**P175 リスト17.8 ファイルを使った入出力の検証**
135165
`Tasks: map[int]*entity.Task{},` ではなく、`Tasks: map[entity.TaskID]*entity.Task{},`に修正。(2022/08/06)
136166

167+
**P185 リスト18.4 MySQLコンテナの設定の追加前後を比較した「docker-compose.yml」の差分**
168+
「`TODO_DB_DATABASE: todo`」ではなく、「`TODO_DB_NAME: todo`」に修正。
169+
[@ac0mz](https://github.com/ac0mz)さん[ご指摘](https://github.com/budougumi0617/go_todo_app/discussions/39) ありがとうございました(2022/09/04)
170+
137171
**P187 SECTION-072 MySQL実行環境の構築**
138172
「GitHub Actionis上でMySQLコンテナを起動します。」ではなく、「GitHub Actions上でMySQLコンテナを起動します。」に修正。
139173
「GitHub Actionisではサービスコンテナという方法で」ではなく、「GitHub Actionsではサービスコンテナという方法で」に修正。
@@ -150,10 +184,41 @@ if !bytes.Contains(rawPrivKey, want) {
150184
}
151185
```
152186

187+
**P233 リスト20.14 「JWTer」構造体と初期化関数の定義**
188+
「`NewJWTer`」関数の実装を次のように修正。
189+
190+
```go
191+
func NewJWTer(s Store, c clock.Clocker) (*JWTer, error) {
192+
j := &JWTer{Store: s}
193+
privkey, err := parse(rawPrivKey)
194+
if err != nil {
195+
return nil, fmt.Errorf("failed in NewJWTer: private key: %w", err)
196+
}
197+
pubkey, err := parse(rawPubKey)
198+
if err != nil {
199+
return nil, fmt.Errorf("failed in NewJWTer: public key: %w", err)
200+
}
201+
j.PrivateKey = privkey
202+
j.PublicKey = pubkey
203+
j.Clocker = c
204+
return j, nil
205+
}
206+
```
207+
208+
[@kdnakt](https://twitter.com/kdnakt)さん[ご指摘](https://github.com/budougumi0617/go_todo_app/discussions/44)ご指摘ありがとうございました(2022/09/04)
209+
153210
**P244 SECTION-085 ユーザーログインエンドポイントの実装**
154211
「`LoginServiceインターフェースはauth/service.goに追記し,`」ではなく「`LoginServiceインターフェースはhandler/service.goに追記し,`」に修正。
155212
[@manaty226](https://github.com/manaty226)さん[ご指摘](https://github.com/budougumi0617/go_todo_app/discussions/27)ご指摘ありがとうございました(2022/08/10)
156213

157214
**P250 リスト20.32 「POST /login」エンドポイントを追加する**
158215
「`JWTer: jwter,`」ではなく、「`TokenGenerator: jwter,`」に修正。
159-
[@yskgc](https://github.com/yskgc)さん[ご指摘](https://github.com/budougumi0617/go_todo_app/discussions/31)ご指摘ありがとうございました(2022/08/12)
216+
[@yskgc](https://github.com/yskgc)さん[ご指摘](https://github.com/budougumi0617/go_todo_app/discussions/31)ご指摘ありがとうございました(2022/08/12)
217+
218+
**P250 リスト20.32 「POST /login」エンドポイントを追加する**
219+
「`jwter, err := auth.NewJWTer(rcli)`」ではなく、「`jwter, err := auth.NewJWTer(rcli, clocker)`」に修正。
220+
[@ac0mz](https://github.com/ac0mz)さん[ご指摘](https://github.com/budougumi0617/go_todo_app/discussions/44) ありがとうございました(2022/09/04)
221+
222+
**P262 「admin」ロールのユーザーのみがアクセス可能なエンドポイントを作成する**
223+
「ミドルウェアの適用順序に気をつけながら実装したのがapply_adminです。」ではなく、「ミドルウェアの適用順序に気をつけながら実装したのがリスト20.47の実装です。リスト20.47では、アクセストークンから`http.Request`型の値に含まれる`context.Context`型の値にユーザーIDとロールを埋め込む`handler.AuthMiddleware`が実行されたあとに`handler.AdminMiddleware`が実行され順序でミドルウェアを適用しています。」に修正・追記。
224+
[@ac0mz](https://github.com/ac0mz)さん[ご指摘](https://github.com/budougumi0617/go_todo_app/discussions/45) ありがとうございました(2022/09/04)

0 commit comments

Comments
 (0)