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

Goでデーモンを作ってみる

 Goでデーモンを作ってみる

Go Conference 2016 SprintのLT資料です。 #gocon
サンプルコード: https://gist.github.com/hironobu-s/548b98c63d4cb6cede95

Hironobu Saitoh

April 23, 2016
Tweet

More Decks by Hironobu Saitoh

Other Decks in Programming

Transcript

  1. (PͰσʔϞϯΛ࡞ͬͯΈΔ
    (P$POGFSFODF4QSJOH
    )JSPOPCV4BJUPI

    View full-size slide

  2. w ੪౻߂৴ ͻΖͷͿ

    w (.0*OUFSOFU *OD
    w 0QFO4UBDLͱ͔Ϋϥ΢υͷ࢓ࣄͯ͠·͢
    @hironobu_s
    hironobu.saitoh
    hironobu-s

    View full-size slide

  3. (PͰσʔϞϯΛॻ͖͍ͨ

    View full-size slide

  4. σʔϞϯΛॻ͖͍ͨ
    w ࣗ࡞ͷ(PϓϩάϥϜͰඞཁʹͳͬͨ
    w JOJUE΍TVQFSWJTPSE΍TZTUFNEͰ΍Δͷ͕ਖ਼࿦ͬΆ͍
    w Ͱ΋৭ʑ໘౗ͳͷͰ୯ಠͰಈ͘΍͕ͭ΄͔ͬͨ͠

    View full-size slide

  5. σʔϞϯ
    w ཁ͸όοΫάϥ΢ϯυϓϩηεͷ͜ͱ
    w IUUQEͱ͔NZTRMEͱ͔
    w EBFNPO͸ʮѱຐʯͰ͸ͳ͘ʮकޢਆʯͷ͜ͱ
    w Ұൠతʹ͸GPSL
    ͯࣗ͠෼ࣗ਎Λෳ੡ͯ͠ɺ਌͕ऴྃ͢Ε͹ྑ͍

    View full-size slide

  6. σʔϞϯԽ GPSL

    View full-size slide

  7. TZTDBMM3BX4ZTDBMM

    (PͰ΋ҰԠͰ͖Δ

    View full-size slide

  8. TZTDBMM3BX4ZTDBMM

    8JOEPXTͰ͸ಈ͔ͳ͍

    View full-size slide

  9. GPSL͸ແཧ
    IUUQTHJUIVCDPNHPMBOHHPJTTVFT
    2(PͰGPSLͨ͠ΓσʔϞϯͭͬͨ͘Γ͢Δʹ͸
    Ͳ͏͢Δͷ͕ྑ͍ͷ͔ͳʁʁʁ

    View full-size slide

  10. GPSL͸ແཧ
    IUUQTHJUIVCDPNHPMBOHHPJTTVFT
    (Pʹ؆୯ʹ௥Ճ͢Δͷ͸ແཧͩΑ
    ͋ͱɺ͜ͷ࣮૷͸ϓϩάϥϜ͕
    ϚϧνεϨουͷ࣌͸ͪΌΜͱಈ͔ΜΑ

    View full-size slide

  11. ͡Ό͊Ͳ͏͢ΔΑʁ
    w PT4UBSU1SPDFTT
    ΍FYFD$PNNBOE
    Λ࢖͏
    w ࣗ෼ࣗ਎Λ֎෦ίϚϯυͱ࣮ͯ͠ߦ͢Δ
    w ˢGPSL
    ͱ͸ҧ͏ͷͰ޻෉͕͍Δ

    View full-size slide

  12. ޻෉
    w ਌ϓϩηε͸ࢠϓϩηεΛϑϥά DIJME
    ෇͖Ͱ࣮ߦ͢Δ
    w ਌ࢠͰ͸ύΠϓΛ࢖ͬͯϓϩηεؒ௨৴Λ͢Δ
    IUUQTHJTUHJUIVCDPNIJSPOPCVTCDEDCDFEF

    View full-size slide

  13. σʔϞϯԽ (P

    View full-size slide

  14. ࣗ෼ࣗ਎Λ࣮ߦ͢Δ
    IUUQTHJTUHJUIVCDPNIJSPOPCVTCDEDCDFEF

    View full-size slide

  15. NBJO

    IUUQTHJTUHJUIVCDPNIJSPOPCVTCDEDCDFEF

    View full-size slide

  16. PT1JQF

    IUUQTHJTUHJUIVCDPNIJSPOPCVTCDEDCDFEF
    FYFD$.%

    View full-size slide

  17. ͓ΘΓʹ
    w (PͳΓͷ΍ΓํͰ΍ͬͯΈͨ
    w (JU)VCͷϦϙδτϦݟͯ΋େମಉ͡Α͏ͳײ͡
    w ଞʹྑ͍΍Γํ͋ͬͨΒ஌Γ͍ͨ
    w 0QFO4UBDLڵຯ͋Δਓ͓༑ୡʹͳͬͯԼ͍͞
    IUUQTHJTUHJUIVCDPNIJSPOPCVTCDEDCDFEF

    View full-size slide