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

Go Modules and Proxy Walkthrough

398137161a861ee5412b84b234c65187?s=47 ktr
August 06, 2019

Go Modules and Proxy Walkthrough

#godo_miniconf

398137161a861ee5412b84b234c65187?s=128

ktr

August 06, 2019
Tweet

More Decks by ktr

Other Decks in Programming

Transcript

  1. CyberAgent & Merpay BackendEngineer’s Go ಉ miniConf Go Modules and

    Proxy 
 Walkthrough
  2. w LUS Ωλϩʔɺ!LUS@  w ϝϧϖΠ৽ଔ
 όοΫΤϯυΤϯδχΞ w $PEF1BZNFOU5FBN XIPBNJ

  3. CyberAgent & Merpay BackendEngineer’s Go ಉ miniConf Go Modules and

    Proxy 
 Walkthrough
  4. 8IBUJT(P.PEVMFT

  5. w (PͷόʔδϣχϯάγεςϜ w 3VTT$PYͷ(P7FSTJPOJOHͱWHPͰొ৔ w (P͔Βݶఆతͳαϙʔτ (P.PEVMFT

  6. w ϦϙδτϦͷϞδϡʔϧԽ w ηϚϯςΟοΫόʔδϣχϯά w HPNPEʹΑΔґଘ؅ཧ w HPTVNʹΑΔνΣοΫαϜͷ؅ཧ (P.PEVMFTͷಛ௃

  7. DSD UMW NQN NQNKQRS UPPMT ϦϙδτϦͷϞδϡʔϧԽ go.mercari.io/go-emv-code . ᵓ── crc16

    ᵓ── mpm │ └── jpqr ᵓ── tlv └── tools
  8. DSD UMW NQN NQNKQRS UPPMT HPNPEUJEZ go.mercari.io/go-emv-code . ᵓ── crc16

    ᵓ── go.mod ᵓ── go.sum ᵓ── mpm │ └── jpqr ᵓ── tlv └── tools go.mercari.io/go-emv-code
  9. DSD go.mercari.io/go-emv-code UMW NQN NQNKQRS UPPMT • v0.1.1 • v0.1.0

    Ϟδϡʔϧ୯ҐͰόʔδϣχϯά "v" ͸͚ͭΔඞཁ͕͋Δʂ
  10. WQBDLBHFT go.mercari.io/go-emv-code/v2 • v2.0.0 ޙํޓ׵ੑ͕อͯͳ͍࣌

  11. w (PNPEVMFTΛ༗ޮԽ͢Δ͔Ͳ͏͔ઃఆͰ͖Δ w PO༗ޮԽ w P⒎ແޮԽ w BVUP σϑΥϧτ 

    w (01"5)TSDͷ֎͔ͭHPNPE͕͋Ε͹༗ޮ (0.0%6-&
  12. None
  13. w (PͰ΋BVUP͕σϑΥϧτͷ·· w ͨͩ͠ɺ(01"5)TSDͷதͰ͋ͬͯ΋HPNPE͕
 ͋Ε͹༗ޮԽ͞ΕΔ (0.0%6-& (P

  14. w (PNPEVMFT͕༗ޮͩͱHPHFUͷڍಈ͕มΘΔ w (01"5)TSDʹ഑ஔ͞Εͳ͘ͳΔ w HPNPEͱHPTVNͷॻ͖׵͑ w όʔδϣϯͳͲΛࢦఆͯ͠ͷऔಘ NPEVMFBXBSFHPHFU

  15. $ export GO111MODULE=on $ go get go.mercari.io/go-emv-code # latest (v0.1.1)

    $ go get go.mercari.io/go-emv-code@v0.1.0 # version $ go get go.mercari.io/go-emv-code@670be75 # commit hash $ go get -u=patch go.mercari.io/go-emv-code # v0.1.1 NPEVMFBXBSFHPHFU
  16. (P.PEVMF&DPTZTUFN

  17. w .PEVMF*OEFY w .PEVMF"VUIFOUJDBUJPO w .PEVMF.JSSPST w .PEVMF1SPYZ (P.PEVMF&DPTZTUFN

  18. w ύϒϦοΫʹར༻ՄೳͳϞδϡʔϧΛ
 ΫΤϦΛ࢖ͬͯݕࡧͰ͖ΔαʔϏε w ࣮૷͸JOEFYHPMBOHPSHͷΈ .PEVMF*OEFY

  19. None
  20. None
  21. w (01"5)HPHFU͸தؒऀ߈ܸʹରͯ͠੬ऑ .PEVMF"VUIFOUJDBUJPO

  22. w (01"5)HPHFU͸தؒऀ߈ܸʹରͯ͠੬ऑ w NPEVMFBXBSFHPHFUͰ͸HPTVNͰ
 ਖ਼͍͠Ϟδϡʔϧ͔ΛݕূՄೳʹʂ .PEVMF"VUIFOUJDBUJPO

  23. w Ҏલʹऔಘͨ͠ϞδϡʔϧͷνΣοΫαϜΛอ࣋ HPTVNͷ໰୊

  24. w Ҏલʹऔಘͨ͠ϞδϡʔϧͷνΣοΫαϜΛอ࣋ ॳճऔಘ࣌ʹਅਖ਼ੑΛ֬ೝͰ͖ͳ͍ HPTVNͷ໰୊

  25. w ͋ΒΏΔϞδϡʔϧͷνΣοΫαϜΛ
 ू໿͢ΔαʔϏε w ࣮૷͸TVNHPMBOHPSHͷΈ (PDIFDLTVNEBUBCBTF TVNEC

  26. w Ϟδϡʔϧͷίʔυ΍νΣοΫαϜͷΩϟογϡΛߦ͏ w ಛఆͷαʔόͷՄ༻ੑ΍ϨΠςϯγʹӨڹ͞ΕΔͷΛ๷͙ .PEVMF.JSSPST

  27. w Ϟδϡʔϧͷίʔυ΍νΣοΫαϜͷΩϟογϡΛߦ͏ w ಛఆͷαʔόͷՄ༻ੑ΍ϨΠςϯγʹӨڹ͞ΕΔͷΛ๷͙ w Ұ౓Ωϟογϡ͞ΕͨϞδϡʔϧ͸جຊతʹ࡟আ͞Εͳ͍ .PEVMF.JSSPST

  28. w Ϟδϡʔϧͷίʔυ΍νΣοΫαϜͷΩϟογϡΛߦ͏ w ಛఆͷαʔόͷՄ༻ੑ΍ϨΠςϯγʹӨڹ͞ΕΔͷΛ๷͙ w Ұ౓Ωϟογϡ͞ΕͨϞδϡʔϧ͸جຊతʹ࡟আ͞Εͳ͍ w ϦϙδτϦ࡟আʹରॲ͢ΔͨΊ FHHPCJOEBUB .PEVMF.JSSPST

  29. w .PEVMFQSPYZQSPUPDPMΛ࣮૷͢ΔαʔϏε w QSPYZHPMBOHPSHɺ"UIFOTͳͲ w (P͔Β͸HPίϚϯυ͸ΦϦδϯαʔόͰ ͸ͳ͘QSPYZ΁ίʔυΛऔಘ͠ʹ͍͘ .PEVMF1SPYZ

  30. w (&5(01309:NPEVMF!WMJTU w (&5(01309:NPEVMF!WWFSTJPOJOGP w (&5(01309:NPEVMF!WWFSTJPONPE w (&5(01309:NPEVMF!WWFSTJPO[JQ .PEVMFQSPYZQSPUPDPM

  31. None
  32. (01309:ͱ(046.%# $ export GOPROXY="https://proxy.golang.org,direct" # default $ export GOPROXY="off" #

    disable proxies $ export GOSUMDB="sum.golang.org" # default $ export GOSUMDB="off" # disable sumdb
  33. HP ίϚϯυ QSPYZ QSPYZHPMBOHPSH TVNEC TVNHPMBOHPSH JOEFY JOEFYHPMBOHPSH NPEVMFͷऔಘ DIFDLTVNͷऔಘ

    (P%PD NPEVMF৘ใͷऔಘ (JU)VC  #JUCVDLFU FUD
  34. w JOEFYͳ͠ w TVNECҰ෦ͷΈHPMBOHPSHYNPETVNECʹଘࡏ w NJSSPSͳ͠ w QSPYZͳ͠ ֤αʔϏεͷެ࣮ࣜ૷

  35. w ͍ͣΕHPMBOHPSHYNPEͰެ։͞Ε͍ͯ͘ w ͦΕͧΕͷ࣮૷͸DNEHPJOUFSOBMҎԼͰ
 ։ൃ͞Ε͍ͯΔ w (P·Ͱʹ͢΂ͯެ։͞Εͦ͏ʜʁ ֤αʔϏεͷެ࣮ࣜ૷

  36. 1SJWBUF.PEVMFT

  37. 1SJWBUF.PEVMFT HP ίϚϯυ ϓϥΠϕʔτ
 ϦϙδτϦ QSPYZ QSPYZHPMBOHPSH

  38. 1SJWBUF.PEVMFT HP ίϚϯυ ϓϥΠϕʔτ
 ϦϙδτϦ QSPYZ QSPYZHPMBOHPSH ❌

  39. w (PͰ͸σϑΥϧτͰQSPYZHPMBOHPSH
 Λܦ༝͢Δ w ηΩϡϦςΟతͳ໰୊͔ΒϞδϡʔϧͷऔಘʹ
 ࣦഊͨ͠৔߹͸ίϚϯυͷ࣮ߦ͕ࢭ·Δ 1SJWBUF.PEVMFT

  40. w (PͰ͸σϑΥϧτͰQSPYZHPMBOHPSH
 Λܦ༝͢Δ w ηΩϡϦςΟతͳ໰୊͔ΒϞδϡʔϧͷऔಘʹ
 ࣦഊͨ͠৔߹͸ίϚϯυͷ࣮ߦ͕ࢭ·Δ w ୯७ʹ(PͷόʔδϣϯΛ্͛Δ͚ͩͩͱϏϧυ͕௨Βͳ͘ͳΔ 1SJWBUF.PEVMFT

  41. (0/01309: $ export GONOPROXY="github.com/ktr0731/priv-mod" $ go get github.com/ktr0731/priv-mod

  42. w ·ͩ೉ͦ͠͏ʜ w ެࣜͷ࣮૷͕ͳ͍ w #BTJDೝূ͔͠࢖͑ͳ͍ 1SPYZͷηϧϑϗετ

  43. ·ͱΊ

  44. w (0.0%6-&͸(PͰ΋มΘΒͣBVUP w (PNPEVMFT͕༗ޮͩͱHPHFUͷڍಈ͕มΘΔ w ηϚϯςΟοΫόʔδϣχϯάͰόʔδϣχϯά (P.PEVMFT

  45. w JOEFYΫΤϦʹΑΔϞδϡʔϧͷݕࡧ w TVNEC͋ΒΏΔϞδϡʔϧͷνΣοΫαϜΛू໿ w NJSSPSϞδϡʔϧ΍νΣοΫαϜͷΩϟογϡ w QSPYZHPίϚϯυ΁Ϟδϡʔϧ৘ใΛఏڙ (P.PEVMF&DPTZTUFN

  46. w QSPYZHPMBOHPSH͸ϓϥΠϕʔτϦϙδτϦ΁
 ΞΫηεͰ͖ͳ͍ w (0/01309:Λద੾ʹઃఆ͢Δ 1SJWBUF.PEVMFT

  47. w(P7FSTJPOJOHIUUQTSFTFBSDITXUDIDPNWHP w.PEVMFT8JLJIUUQTHJUIVCDPNHPMBOHHPXJLJ.PEVMFT w(P.PEVMFTJOIUUQTCMPHHPMBOHPSHNPEVMFT w1SPQPTBM4FDVSFUIF1VCMJD(P.PEVMF&DPTZTUFN
 IUUQTHPHPPHMFTPVSDFDPNQSPQPTBM NBTUFSEFTJHOTVNECNE wJOEFY TVNEC QSPYZIUUQTJOEFYHPMBOHPSH w(P3FMFBTF/PUFTIUUQTUJQHPMBOHPSHEPDHPNPEVMFT

    w(P%PDIUUQTHPEPDPSHHJUIVCDPNHPMBOHHPTSDDNEHPJOUFSOBM wUJQHPMBOHPSHIUUQTUJQHPMBOHPSHDNEHP w(PQIFS$PO(P.PEVMF1SPYZ-JGFPGBRVFSZ
 IUUQTBCPVUTPVSDFHSBQIDPNHPHPQIFSDPOHPNPEVMFQSPYZMJGFPGBRVFSZ wQSPQPTBMYNPEOFXSFQPGPSNPEVMFNFDIBOJDTIUUQTHJUIVCDPNHPMBOHHPJTTVFT wDNEHPEFpOF)551BVUIFOUJDBUJPOFYUFOTJPONFDIBOJTNIUUQTHJUIVCDPNHPMBOHHPJTTVFT wDNEHPEFGBVMUUP(0.0%6-&BVUP XJUIDIBOHFT GPS(PIUUQTHJUIVCDPNHPMBOHHP JTTVFT ࢀߟ
  48. 5IBOLZPVGPSMJTUFOJOH