-
Notifications
You must be signed in to change notification settings - Fork 0
# Wataru / boru 課題1 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
レビューしました!
kadai1/wataboru/.gitignore
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignoreする必要はないですね
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
github.comからのパスの方が好ましいです。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
終了コードは外部に伝えるものなので iota は使わない方が安全です。
iota を使う値は区別さえできればOKで値として意味がないものに限ります。
終了コードは0が成功、それ以外が失敗という値に意味を持っているので使わないほうがが良いです。
DBに入れる値なんかも同様です。
kadai1/wataboru/README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
テスト用の画像は testdata というディレクトリを作ってその下に入れましょう。
testdata という名前のディレクトリはGoにパッケージとして認識されません。
同様に_で始まるディレクトリ(よく_exampleとして使用される)や.で始まるディレクトリも無視されます。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
詰める
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create は書き込みの処理なので、Close する際にもエラー処理をする。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
エラーをreturnするならログを出さない。
ログを出すならエラーを返さない。
エラーログの出力もエラーハンドリングの1つでエラーハンドリングは1度だけにする。
出すとしても標準エラー出力の方が好ましそう。
- Modify import statement in main.go. - Add error handling to defer of imageconverter.convertImage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tenntenn
こちら、分かる限り修正してみました。
一点質問がありまして、defer内で呼び出し元にエラーを返す処理を実現するため、名前付き戻り値を使ってしまっています。
他の方のレビューの中で、「何をreturnしたか追いづらいので、名前付き戻り値はできるだけ使わない。」とあったので、名前付き戻り値を使わずにどのように呼び出し元にエラーを返したら良いか教えていただきたいです。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
このパターンのみ使わないとどうにもならないので使っても大丈夫です!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tenntenn
なるほど!そうなんですね。
一応その他の場所は明示的にreturnに渡す様にしました。
Uh oh!
There was an error while loading. Please reload this page.
課題1のPRになります。レビューをお願いいたします。
以下README.mdより転記
課題 1 【TRY】画像変換コマンドを作ろう
次の仕様を満たすコマンドを作って下さい
以下を満たすように開発してください
実行手順
コメント
golang.org/x/imageを導入しました