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
make and learn minimum golint
Search
Masayuki Morita
June 05, 2017
Programming
0
5.6k
make and learn minimum golint
Masayuki Morita
June 05, 2017
Tweet
Share
More Decks by Masayuki Morita
See All by Masayuki Morita
.terraform.lock.hcl 完全に理解した / How to update .terraform.lock.hcl efficiently
minamijoyo
16
18k
tfschemaの仕組み / How tfschema works
minamijoyo
2
620
SRE Lounge#2: SRE at CrowdWorks
minamijoyo
1
2.5k
BigData-JAWS #9: Data Analytics Infra for CrowdWorks
minamijoyo
3
530
20170605_make_and_learn_minimum_golint.pdf
minamijoyo
0
47
private_homebrew_20170525.pdf
minamijoyo
0
57
非公開な社内限のCLIツールを Homebrewで配布したい
minamijoyo
3
970
Other Decks in Programming
See All in Programming
Android 15 でアクションバー表示時にステータスバーが白くなってしまう問題
tonionagauzzi
0
130
Kaigi on Rails 2024 - Rails APIモードのためのシンプルで効果的なCSRF対策 / kaigionrails-2024-csrf
corocn
5
3.3k
gopls を改造したら開発生産性が高まった
satorunooshie
8
240
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
6
2.6k
カラム追加で増えるActiveRecordのメモリサイズ イメージできますか?
asayamakk
4
1.5k
OpenTelemetryでRailsのパフォーマンス分析を始めてみよう(KoR2024)
ymtdzzz
4
1.5k
cXML という電子商取引の トランザクションを支える プロトコルと向きあっている話
phigasui
3
2.2k
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
8
940
Java ジェネリクス入門 2024
nagise
0
580
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
230
Modern Angular: Renovation for Your Applications
manfredsteyer
PRO
0
180
レガシーな Android アプリのリアーキテクチャ戦略
oidy
1
170
Featured
See All Featured
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Typedesign – Prime Four
hannesfritz
39
2.4k
Designing Experiences People Love
moore
138
23k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Visualization
eitanlees
144
15k
Navigating Team Friction
lara
183
14k
Producing Creativity
orderedlist
PRO
341
39k
BBQ
matthewcrist
85
9.3k
A Philosophy of Restraint
colly
203
16k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Transcript
࡞ֶͬͯͿ ϛχϚϜgolint GoݴޠLTେձ 2017/06/05 @minamijoyo
ࣗݾհ • ా ਅ೭ (Masayuki Morita) • Twitter/GitHub: @minamijoyo •
CrowdWorks Inc. • Πϯϑϥ୲ • ͍͍ͩͨAWS/Terraform/Dockerͱ͔͍ͬͯ͡Δ
Πϯϑϥ୲͕ࠓ͙͢ GoΛֶͿ͖3ͭͷཧ༝ 1. GoϛυϧΣΞCLIπʔϧ͕૿͖͑ͯͨɻ 2. bashεΫϦϓτͭΒ͍ɻGoॻָ͍͍ͯͯ͠ɻ 3. Gopher͘Μ͕͔Θ͍͍ɻ The Go
gopher was designed by Renée French.
ࠓͷςʔϚ: ࠷ۙɺgolintͰ༡ΜͰΈͨ
golintͯ͠·͔͢ʁ
golint • ެࣜͷLinter • GoͬΆ͘ͳ͍ίʔσΟϯάελΠϧΛࢦఠ $ go get -u github.com/golang/lint/golint
$ golint main.go main.go:6:2: var instanceId should be instanceID
Ͳ͏ͬͯఆͯ͠Δͷ͔ʁ
ͨͩͷࣙॻͩͬͨ (※࣮ࡍʹ୯ޠͷ్தͷͷݕग़͍ͯ͠ΔͷͰগ͠ෳࡶʣ https://github.com/golang/lint/blob/master/lint.go
͔͠͠ golintͷίʔυΛͨͩோΊͯͯ ੩తղੳ͕ ॳ৺ऀʹΑ͘Θ͔ΒΜͷͰ͢
ͦ͏ͩ golint࡞Ζ͏
ϓϩάϥϛϯάֶशͷجຊ: ·ͶΔ
࡞ֶͬͯͿ golint
ϛχϚϜͳཁ݅ • ػೳɿಛఆͷม໊Λ୳͢ • ೖྗɿ1ϑΝΠϧͷΈҾͰϑΝΠϧ໊Λ͢ • ग़ྗɿϚονͨ͠ϑΝΠϧ໊:ߦ:ΧϥϜΛදࣔ
80ߦ͙Β͍Ͱॻ͚ͨ
←ඪ४ͷgoύοέʔδΛ͏ ↓ҾͰೖྗϑΝΠϧ໊ΛΒ͏
↓ϑΝΠϧΛύʔεͯ͠ASTΛऔಘ
↑ࠨลͷࣝผࢠΛऔΓग़ͯ͠νΣοΫ ↑ASTΛ࠶ؼతʹ୳ࡧ ←มೖࣜΛ୳͢visitor
↑ม໊ʹϚονͨ͠ΒҐஔΛग़ྗ ←୳͢ม໊ͷఆٛ
มwallyΛ୳ͤ
wally + golint = wallint
$ wallint data/wally.go data/wally.go:6:2: wally was found
͔ͤͬ͘ͳͷͰ ΤσΟλʹΈࠐΜͰΈͨ
มwallyΛ୳ͤ
ҰॠͰӅΕͨมwallyΛݕग़
·ͱΊ • ϓϩάϥϛϯάͷجຊ·ͶΔ͜ͱ • ࡞ֶͬͯͿͱཧղ͕ਂ·Δ • આ໌ʹͬͨίʔυˣ • https://github.com/minamijoyo/wallint