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

Go言語をほぼ毎日書いている話 (序) / Daily coding in Go

Go言語をほぼ毎日書いている話 (序) / Daily coding in Go

そうだ、Go京都。

Yuuki Tsubouchi (yuuk1)

April 29, 2017
Tweet

More Decks by Yuuki Tsubouchi (yuuk1)

Other Decks in Programming

Transcript

  1. GoݴޠΛ
    ΄΅ຖ೔ॻ͍͍ͯΔ࿩ (ং)
    ͸ͯͳ id:y_uuki

    View full-size slide

  2. id:y_uuki / @y_uuk1
    Yuuki Tsubouchi
    https://yuuk.io
    גࣜձࣾ͸ͯͳ
    WebΦϖϨʔγϣϯΤϯδχΞ / γχΞΤϯδχΞ

    View full-size slide

  3. Goྺ
    • 2013೥͙Β͍͔ΒWatch
    • 2014೥ʹ·ͱ΋ʹॻ͖࢝Ίͨ
    • ࠷ॳ͸Tour of Go
    • Go Kyotoͱ͍͏Jxck ͞ΜʹΑΔϋϯζΦϯʹࢀՃ
    • mkr / mackerel-client-go ͳͲΛॻ͍ͨ
    • 2015೥~2016લ൒ ͍͔ͭ͘ΦϖϨʔγϣϯπʔϧͭͬͨ͘
    • grabeni / droot / gokc ͳͲ

    View full-size slide

  4. http://developer.hatenastaff.com/entry/golang-for-ops

    View full-size slide

  5. ͳΜͰ
    ຖ೔ॻ͖࢝Ίͨͷ͔

    View full-size slide

  6. ͳΜͰຖ೔ॻ͖࢝Ίͨͷ͔
    • ΦϖϨʔγϣϯ͢ΔΑΓɺιϑτ΢ΣΞͱ͔จষΛॻ
    ͍ͯΔͱ͖ͷ΄͏͕࣮͸޷͖
    • ϒϩά΋͍͍͚Ͳ͍͔ͭ୅දతϓϩμΫτΛ࡞ͬͯΈ
    ͍ͨ
    • ͔͠͠ɺιϑτ΢ΣΞΛॻ͘εΩϧͱɺॻ্͖͛Δମ
    ྗ͕଍Γͳ͍ => ຖ೔ίʔυॻ͜͏

    View full-size slide

  7. Site
    Reliability
    Engineering
    HOW GOOGLE RUNS
    PRODUCTION
    SYSTEMS
    Photo by O’reilly Media / CC by 3.0
    http://shop.oreilly.com/product/0636920041528.do https://creativecommons.org/licenses/by/3.0/deed

    View full-size slide

  8. ͳʹΛ
    ຖ೔ॻ͍͍ͯΔͷ͔

    View full-size slide

  9. DiamonDB
    https://github.com/yuuki/diamondb

    View full-size slide

  10. write
    datapoints
    Kinesis Streams
    Lambda
    read
    datapoints
    ElastiCache
    DynamoDB
    Lambda
    TTL expired
    flush
    write
    Web App
    (Golang)
    S3
    read
    read
    read

    View full-size slide

  11. write
    datapoints
    Kinesis Streams
    Lambda
    read
    datapoints
    ElastiCache
    DynamoDB
    Lambda
    TTL expired
    flush
    write
    Web App
    (Golang)
    S3
    read
    read
    read
    AWSͷෳ਺ͷσʔλετΞΛ
    ૊Έ߹Θͤͨ
    Go ΢ΣϒΞϓϦέʔγϣϯ

    View full-size slide

  12. ͳʹΛຖ೔ॻ͍͍ͯΔͷ͔
    • DiamonDB
    • ͍͍ͩͨಉ͡ΞʔΩςΫνϟͷ΋ͷΛۀ຿Ͱ։ൃத
    • ίʔυϕʔε͸ۀ຿ͷ΋ͱ͸ผ
    • ͜Ε·Ͱͭͬͨ͘πʔϧͷϝϯςφϯε
    • ۀ຿Ͱ࢖͍ͬͯΔͷͰɺमਖ਼΍ػೳ௥Ճ
    • Pull RequestରԠ

    View full-size slide

  13. ຖ೔ॻͨ͘Ίʹ
    ΍Δ͜ͱ

    View full-size slide

  14. ຖ೔ॻͨ͘Ίʹ΍Δ͜ͱ
    • ʮຖ೔ʯࣗମʹ͸ҙຯ͸ͳ͘ɺܧଓతʹίʔυΛॻ͚Δ͔͕େࣄ
    • 1 commit / day Ͱ΋Α͍
    • Ͳ͏ͯ͠΋๩͚͠Ε͹ɺgit commit —date Ͱ೔෇͔͖͔͑
    • ͜ΕͰϞνϕʔγϣϯ͕ଓ͘ͳΒͦΕͰΑ͍
    • ฏ೔͸͋·Γॻ͚ͳ͍ͷͰɺ౔೔ͷ͏ͪʹΠγϡʔΛ༻ҙ
    • ۀ຿ͱ݁ͼ͚ͭΔ
    • ෳ਺ͷϓϩδΣΫτΛ΋ͭ

    View full-size slide

  15. ຖ೔ॻ͍͍ͯͯ
    Θ͔ͬͨ͜ͱ

    View full-size slide

  16. ຖ೔ॻ͍͍ͯͯΘ͔ͬͨ͜ͱ
    • ຖ೔ίʔυॻͨ͘ΊͷϦζϜ͕Ͱ͖Δ
    • ೴಺ϝϞϦʹͷͬͯΔͷͰɺ࣍ʹॻ͘ͱ͖ʹ೰·ͳ͍
    • ͍͖ͳΓେ͖͘มߋ͢ΔͷͰ͸ͳ͘ɺখ͞ͳมߋΛੵ
    ΈॏͶΔΑ͏ʹͳΔ
    • ౔೔ʹແཧ͠ͳ͘ͳΔ
    • ແཧΛ͢Δͱ݁ہଓ͔ͳ͍

    View full-size slide

  17. https://github.com/yuuki/yuuki/blob/master/golang/http-api-server-stack.md
    GoͰHTTP APIαʔόॻ͘ͱ͖ͷελοΫ
    GoͰHTTP APIαʔόॻ͘
    ͱ͖ͷελοΫ

    View full-size slide

  18. https://medium.com/@haya14busa/idiomatic-go-readability-f0b42ef381dc

    View full-size slide

  19. https://github.com/golang/go/wiki/CodeReviewComments

    View full-size slide

  20. ;ͩΜΈ͍ͯΔ Gophers
    • @deeeet
    • @mattn
    • @motemen
    • @Songmu
    • @haya14busa
    • @davecheney
    • @dgryski

    View full-size slide

  21. Πϯϓοτ
    ͱ
    Ξ΢τϓοτ

    View full-size slide

  22. ΠϯϓοτͱΞ΢τϓοτ
    • Πϯϓοτ: ຊΛಡΉɺϒϩάΛಡΉͳͲ
    • Ξ΢τϓοτ: ٕज़ஊٛɺൃදɺϒϩάɺίʔυͳͲ
    • ݺٵͷΑ͏ͳ΋ͷ
    • Πϯϓοτ͢ΔͱΞ΢τϓοτͨ͘͠ͳΔɻΞ΢τϓο
    τ͢Δͱ·ͨΠϯϓοτΛ΋ͱΊΔ
    • Ξ΢τϓοτ͸ҰݟແବʹΈ͑Δ͕ɺఆظతʹΞ΢τϓο
    τ͢Δ͜ͱͰΠϯϓοτ΋૿͍͑ͯ͘

    View full-size slide

  23. GoݴޠΛ
    ΄΅ຖ೔ॻ͍͍ͯΔ࿩ (ং)
    ͸ͯͳ id:y_uuki

    View full-size slide