SoundCloudが2年半ほどGo言語を利用したプロダクトを本番で運用した知見をGopherConで発表していた(“Go: Best Practices for Production Environments”).その中で“CodeReviewCommentsというGoogleでのGo言語のコードレビューにおいてよくあるコメントをまとめたサイトが紹介されていた. 最近Go言語を書くようになり,使えそうなのでざっと抄訳してみた.“リーダブルコード”的な視点も含まれており,Go以外の言語でも使えそう. gofmtでコードの整形をすること コメントは文章で書くこと.godocがいい感じに抜き出してくれる.対象となる関数(変数)名で初めて,ピリオドで終わること // A Request represents a request to run a command. type Request str
CodeReviewComments から Go コードのレビュー時によくされるコメントについて。 gofmt gofmt またはそのスーパーセットである goimports を実行すること。goimports は gofmt に加えて import 行の修正も行う。 コメント文 http://golang.org/doc/effective_go.html#commentary を参照。宣言に対するコメントは少し冗長に見えるかもしれないけど完全な文にする。そうすれば godoc できれいに整形される。次のように説明するものの名前から始めピリオドで終える。 // A Request represents a request to run a command. type Request struct { ... // Encode writes the JSON encoding of re
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く