Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Golangにコントリビュートしたときの話

taisa
February 07, 2020

 Golangにコントリビュートしたときの話

taisa

February 07, 2020
Tweet

More Decks by taisa

Other Decks in Programming

Transcript

  1. Golangにコントリビュートしたときの話
    超スモールスタート!
    taisa

    View Slide

  2. 自己紹介
    ● taisa (@taisa831)
    ● テックタッチ株式会社
    ● Python JP Conferenceコミュニティ
    ● 共著:React、Angular、Vue.js、React Nativeを使って学ぶ はじめてのフロ
    ントエンド開発
    ● 好きな言語:Go / JavaScript / Python

    View Slide

  3. 概要
    ● なにをコントリビュートしたの?
    ● どうやるの?
    ● どうだった?

    View Slide

  4. なにをコントリビュートしたの?
    https://github.com/golang/go/commit/7bdef2dfa4fe7d4d424d5601973b07d42ffc869b

    View Slide

  5. なにをコントリビュートしたの?
    https://github.com/golang/go/blob/master/src/testing/testing.go

    View Slide

  6. どうやるの?
    ● 英語
    ○ Go本体の「Contribution Guide」に詳しく手順が書かれています。
    ○ https://golang.org/doc/contribute.html
    ● 日本語
    ○ 「Go にコントリビュートするまでの手順」に丁寧に書かれています。
    ○ https://syfm.hatenablog.com/entry/2017/07/05/020535

    View Slide

  7. 特徴
    ● go.googlesource.com にユーザ登録が必要がある
    ● Contributor License Agreement (CLA) に同意する必要がある
    ● Gerrit でレビューを行っている(GitHubはmirror)
    ○ Googleが開発
    ○ ユーザ登録が必要
    ● git-codereview というコマンドラインツールを利用する
    ○ Gitを拡張したもの
    → 最初のセットアップが結構めんどいけど1回やったらあとはすごい楽

    View Slide

  8. Gerrit
    ● https://go-review.googlesource.com/c/go/+/209777

    View Slide

  9. git-codereview
    ● $ go get -u golang.org/x/review/git-codereview
    ● $ git codereview help
    $ git codereview change
    $ git codereview gofmt
    $ git codereview mail
    $ git codereview pending
    $ git codereview submit
    $ git codereview sync
    https://golang.org/doc/contribute.html#sending_a_change_github

    View Slide

  10. コミットメッセージ例
    math: improve Sin, Cos and Tan precision for very large arguments
    The existing implementation has poor numerical properties for
    large arguments, so use the McGillicutty algorithm to improve
    accuracy above 1e10.
    The algorithm is described at
    https://wikipedia.org/wiki/McGillicutty_Algorithm
    Fixes #159
    https://golang.org/doc/contribute.html#commit_messages

    View Slide

  11. どうだった?
    ● レビューは結構早い
    ● 今回の内容であれば夜にレビュー依頼したら翌日の朝には返信がきた
    ● コメントがめちゃくちゃ優しい
    >Thanks, but I don't see why this change is correct. The "output" >comment can have text immediately
    following "output".
    >Thanks. Let's just change the argument to 5 or otherwise adjust the >numbers to keep a number on that
    line.
    >Thanks.
    https://go-review.googlesource.com/c/go/+/209777

    View Slide

  12. まとめ
    ● GitHubじゃなくてGerritを使う
    ● ソース管理はGitの拡張であるgit-codereviewを使う
    ● 初期セットアップはちょっとめんどいけどできたらあとは楽
    ● レビューはすぐやってくれる傾向にある
    ● レビューのコメントは超小粒の内容でもめちゃくちゃやさしい
    この流れで2019年にテストに関するアドベントカレンダーを書きました。
    「Goのtestingパッケージの基本を理解する」
    https://qiita.com/taisa831/items/85fea8d970bcadd796b9

    View Slide