Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Understand Go Modules / Go Modulesを理解する
Search
linyows
February 12, 2019
Programming
6
1.6k
Understand Go Modules / Go Modulesを理解する
Fukuoka.go#13 + Okayama.go で話した資料です。Feb 12, 2019
linyows
February 12, 2019
Tweet
Share
More Decks by linyows
See All by linyows
奥が深いメールのシステム / The depth of Email system
linyows
3
370
IaCにおけるテスト考察 / Tests in IaC
linyows
2
370
リバースエンジニアリングとGoでSlackの認知負荷を下げる / Reducing cognitive load in Slack with Reverse-engineering and Go
linyows
2
240
透過型SMTPプロキシによる送信メールの可観測性向上 / Improved observability of outgoing emails with transparent smtp proxy
linyows
2
890
プロダクションで使うGo Pluginの利便性とパフォーマンス性 / Simplicity and Performance of Go plugin for Production
linyows
0
460
求められるソフトウェアエンジニア像とキャリア戦略 / Engineers and Career Strategies Required Now
linyows
2
440
CloudflareのCAPTCHAを使って ユーザ体験を下げず不正利用を排除する / Cloudflare's captcha case study that does not degrade ux
linyows
0
320
なぜNotionを使うのか2022 / Why use notion as our workspace in 2022
linyows
3
5.9k
Denoの仕組み / How deno works as TypeScript runtime
linyows
2
750
Other Decks in Programming
See All in Programming
Understand the mechanism! Let's do screenshots tests of Compose Previews with various variations / 仕組みから理解する!Composeプレビューを様々なバリエーションでスクリーンショットテストしよう
sumio
3
880
僕が思い描くTypeScriptの未来を勝手に先取りする
yukukotani
9
2.4k
LangChainでWebサイトの内容取得やGitHubソースコード取得
shukob
0
160
Amazon BedrockでサーバレスなAIお料理ボットを作成する!!
tosuri13
0
230
What you can do with Ruby on WebAssembly
kateinoigakukun
0
170
GoのIteratorに詳しくなってしまう
inatonix
1
210
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
560
Method Swizzlingを行うライブラリにおけるマルチモジュール設計
yoshikma
0
120
API Platform for Laravel
dunglas
1
740
Prolog入門
qnighy
4
1k
Scala におけるコンパイラエラーとの付き合い方
chencmd
2
430
Increased Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
450
Featured
See All Featured
Music & Morning Musume
bryan
46
6k
No one is an island. Learnings from fostering a developers community.
thoeni
18
2.9k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
363
22k
Fontdeck: Realign not Redesign
paulrobertlloyd
80
5.1k
Bootstrapping a Software Product
garrettdimon
PRO
304
110k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
28
1.6k
Building Flexible Design Systems
yeseniaperezcruz
325
38k
Robots, Beer and Maslow
schacon
PRO
157
8.2k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
166
48k
GraphQLとの向き合い方2022年版
quramy
43
13k
Building Your Own Lightsaber
phodgson
101
6k
Build your cross-platform service in a week with App Engine
jlugia
228
18k
Transcript
'VLVPLBHP 5PNPIJTB0EB (.01FQBCP *OD 'FCSVBSZ (P.PEVMFTΛཧղ͢Δ
'VLVPLBHP (.0ϖύϘ ϓϦϯγύϧΤϯδχΞ !MJOZPXT CMPHUPNPIJTBPEBDPN
'VLVPLBHP 8&# %#13&44WPM )BTIJ$PSQ7BVMUͷهࣄدߘ ϦϙδτϦͷϦιʔεมߋΛݕ ͯ͠ΞϓϦ͕ೳಈతʹσϓϩ ΠΛߦ͏ιϑτΣΞ MJOVYϢʔβͷ໊લղܾΛ (JU)VC͔ΒϚοϐϯά͢Δ ιϑτΣΞͷ։ൃ
'VLVPLBHP (P.PEVMFT͍ͬͯ·͔͢
'VLVPLBHP ๏ ॳظɿ.BLFpMFͰґଘؔΛղܾ͍ͯͯ͠Կͳ͍ࠒ ๏ HPHFUɿϦϙδτϦ͔Βऔಘ໊͠લͳ͘γϯϓϧͰ࠷ߴͩͬͨ ๏ HPEFQɿόʔδϣϯࢦఆʹΑΓϏϧυ࠶ݱੑΛղܾͯ͘͠Εͨ ๏ HPNPEVMFTɿόʔδϣχϯά͕ಁաతͰ(PΒ͠͞ΛऔΓͨ͠ (PύοέʔδػߏͷભҠ
'VLVPLBHP (P.PEVMFTͷجຊ
'VLVPLBHP ๏ ޙํޓੑΛڧ͘ҙࣝʢࢦఆʣͨ͠όʔδϣχϯά ๏ .BKPS.JOPS1BUDI͜ͷϑΥʔϚοτେମ·͍ͬͯΔͣ ๏ όʔδϣχϯάʹϧʔϧ͕͋Εར༻ଆΘ͔Γ͍͢ʢύοέʔδϚωʔ δϟͷ࣮͕γϯϓϧʹͳΔʣ ๏ ݴޠϨϕϧͰͷޙํޓͷடংϏϧυͷ࠶ݱՄೳੑ্ʹͳΔ
େࣄͳϧʔϧɿ4FNBOUJD7FSTJPOJOH
'VLVPLBHP ๏ ࠷৽ͷόʔδϣϯৗʹߋ৽͞ΕΔ͕࠷ݹͷόʔδϣϯϢχʔΫͰ͋Δ ๏ ଞऀͱϏϧυͨ͠όΠφϦ͕ಉ͡Ͱ͋Δ͜ͱΛอূ͢ΔΈ ๏ ύοέʔδϚωʔδϟʹͱͬͯ࠷৽͕࠷ߴͰͳ͍ ๏ ࠶ݱՄೳੑΛٻͨ݁͠Ռ ͓͠Ζґଘੑղܾɿ.JOJNBM7FSTJPO4FMFDUJPO
'VLVPLBHP ๏ ϕϯμϦϯά͏͠ͳ͍ͷͰϧʔτσΟϨΫτϦʹϑΝΠϧ࡞Βͳ͍ ʢϕϯμϦϯά͕͑ͳ͍ͷͰ.BLFpMFͰؤுͬͯͯඍົͩͬͨʣ ๏ (01"5)TSD͔Β(01"5)QLHNPEԼ ๏ ΩϟογϡͳͷͰؾܰʹHPDMFBONPEDBDIF͢Δ ๏ աظͰTSDԼͱQLHԼͷ྆ํʹࢿ࢈͕͋Γόʔδϣχϯά͕͓͔͘͠ͳΔ
͕࣌͋Δʢ☝ͷΩϟογϡআͰͬͨΓ͢Δʣ ͞ΑͳΒϕϯμϦϯάʢόʔδϣχϯάΩϟογϡʣ
'VLVPLBHP ๏ ݴޠϨϕϧͰͷύοέʔδϚωʔδϟ࣮ʹΑΓ(PίϚϯυͷ࣮ߦґ ଘղܾͱϦϞʔτ͔ΒμϯϩʔυΛࣗಈతʹߦͬͯ͘ΕΔ ๏ ͪΖΜHPNPEʹόʔδϣϯࢦఆېࢭόʔδϣϯࢦఆ͕Ͱ͖Δ͠ɺ SFQMBDFͰҰ෦ϩʔΧϧύοέʔδΛࢦఆ͢Δ͜ͱͰ͖Δ ๏ ͭ·ΓɺԿ͠ͳ͍Ͱ͍͍͠ม͚͑ͨΕ৭ʑͰ͖Δ࠷ߴ Ϣʔβ͕ҙࣝ͠ͳ͍όʔδϣχϯά
'VLVPLBHP (P.PEVMFTͷ༻ྫ
'VLVPLBHP FYQPSU(0.0%6-&4PO͔Β࢝ΊΑ͏
'VLVPLBHP $ go test -v ./… -timeout 30s -parallel 8
$ go build . $ go run main.go go: finding github.com/pierrec/lz4 v2.0.2+incompatible go: finding github.com/lestrrat-go/pdebug v0.0.0-20180220043849-39f9a71bcabe go: finding github.com/jessevdk/go-flags v1.4.0 go: finding github.com/dsnet/compress v0.0.0-20171208185109-cc9eb1d7ad76 go: finding github.com/mholt/archiver v0.0.0-20180417220235-e4ef56d48eb0 go: finding github.com/lestrrat-go/server-starter v0.0.0-20150105222616-88699d57aeee go: finding github.com/google/go-github v17.0.0+incompatible go: finding github.com/hashicorp/logutils v0.0.0-20150609070431-0dc08b1671f3 go: finding github.com/nwaples/rardecode v0.0.0-20171029023500-e06696f847ae go: finding github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82 go: finding github.com/pierrec/xxHash v0.1.1 … RUN ී௨ʹ͏͚ͩͰཪͰ͍͍ײ͡ʹͬͯ͘ΕΔʢऴྃʣ
'VLVPLBHP Α͋͘Δґଘύοέʔδͷϝϯςφϯε
'VLVPLBHP # ґଘύοέʔδͷҰཡ $ go mod graph //or $ go
list -m -f '{{.Version}}' all github.com/linyows/dewy github.com/pkg/
[email protected]
github.com/linyows/dewy github.com/pmezard/
[email protected]
github.com/linyows/dewy github.com/stretchr/
[email protected]
# ߋ৽͕Մೳͳύοέʔδόʔδϣϯͷදࣔ $ go list -u -m all | grep '\[.*\]' github.com/pkg/errors v0.8.0 [v0.8.1] github.com/pmezard/go-difflib v1.0.0 github.com/stretchr/testify v1.2.2 [v1.3.0] # Ұׅߋ৽ $ go get -u ґଘύοέʔδͷόʔδϣϯΛ্͛Δ
'VLVPLBHP # ґଘύοέʔδͷόʔδϣϯͷҰཡ $ go list -versions -m all github.com/pkg/errors
v0.1.0 v0.2.0 v0.3.0 v0.4.0 v0.5.0 v0.5.1 v0.6.0 v0.7.0 v0.7.1 v0.8.0 v0.8.1 github.com/pmezard/go-difflib v1.0.0 github.com/dummy/log v1.1.1 v1.1.2 v1.1.3 v1.1.4 v1.2.0 v1.2.1 v1.2.2 v1.3.0 # ύοέʔδͷμϯάϨʔυ $ go get github.com/dummy/
[email protected]
# editίϚϯυ͔ΒՃআ֎͕Ͱ͖Δʢgo.modͷߋ৽ʣ $ go mod edit -exclude github.com/dummy/
[email protected]
ͷ͋ΔύοέʔδͷόʔδϣϯΛԼ͛Δ
'VLVPLBHP (P.PEVMFTͰࠔͬͨ͜ͱ
'VLVPLBHP w (Pͷ$-*πʔϧ͕HPNPEVMFTରԠͯ͠ͳ͍(0.0%6-&4PGGʹ͢Δ͔13Λ ૹΓ·͠ΐ͏ʢେࣄͳ׆ಈͰ͢ʣ w 1SPKFDUͰΘͳ͍ύοέʔδΛHPHFU͢ΔͱHPNPE͕ߋ৽͞ΕΔ͚͍ܽͯΔ ύοέʔδͷՃඇґଘύοέʔδΛഉআΛߦ͏HPNPEUJEZΛ͍·͠ΐ͏ʢ࣮ (PͰղܾ͍ͯ͠·͢ʣ w 1SPKFDUͰͬͯͳ͍͚Ͳ$-*πʔϧΛνʔϜͰόʔδϣϯݻఆ͢ΔͨΊʹHPNPE
ʹఆ͍ٛͨ͠EVNNZͷύοέʔδΛ࡞ͬͯ1"5)ࢦఆͯ͠HPJOTUBMM͢Δ w ґଘύοέʔδͷҰ෦ΛϩʔΧϧͷͷΛ͍͍ͨSFQMBDFͰϩʔΧϧͯ͢͠Ε ͍͚·͢ʢW͡Όͳ͍ͱμ ϝ͔ʣ
'VLVPLBHP IUUQTHJUIVCDPNHPMBOHHPJTTVFTJTTVFDPNNFOU $ export GOBIN=$PWD/bin $ export PATH=$GOBIN:$PATH $ cat
tools.go 1 // +build tools 2 package tools 3 4 import ( 5 _ "github.com/linyows/git-semv/cmd/git-semv" 6 ) $ go install github.com/linyows/git-semv/cmd/git-semv $ type git-semv /Users/linyows/projectx/bin/git-semv
'VLVPLBHP .PEVMFTPG(P
'VLVPLBHP ๏ NPEVMF֎ͰNPEVMFૢ࡞͕Ͱ͖ΔΑ͏ʹͳͬͨʢHPHFU HPMJTU HPNPEEPXOMPBE͠ ͯॳظঢ়ଶΛҡ࣋͢Δʣ ๏ HPίϚϯυΛฒߦ࣮ߦ͕҆શʹͳͬͨʢpMFTZTUFN͕pMFMPDLJOHΛαϙʔτ͍ͯ͠Δ ඞཁ͕͋Δʣ ๏
HPNPEʹHPόʔδϣϯσ ΟϨΫςΟϒͷαϙʔτʢͳ͚ΕDVSSFOUSFMFBTFΛՃ͢ Δ ๏ NPEVMFΛJNQPSUͰ͖ͳ͍߹ʹΩϟογϡωοτϫʔΫιʔεΑΓઌʹSFQMBDFͰ ࢦఆͨ͠ϩʔΧϧΛݟΔΑ͏ʹͳͬͨ .PEVMFTPG(P
'VLVPLBHP $PODMVTJPO
'VLVPLBHP ๏ (P.PEVMFT(Pͷγϯϓϧ͞Λҡ࣋ͭͭ͠Ϗϧυ࠶ݱੑΛॏࢹͨ͠ઃܭ ʹͳ͍ͬͯͯɺࢲͨͪޙํޓੑΛڧ͘ҙࣝ͠ͳ͚ΕͳΒͳ͍ ๏ (P.PEVMFTͷઃܭࢥΛΔ͜ͱͰ͕ى͖ͯରॲ͢Δ͜ͱ͕Ͱ͖ Δ͠ɺΛཧղ͢Δ͜ͱ͕Ͱ͖Δ ๏ (P.PEVMFTόϯόϯ͍͖ͬͯ·͠ΐ͏ $PODMVTJPO
'VLVPLBHP 5IBOLZPV 8FSFIJSJOH