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
go-critic
Search
Oleg Kovalov
September 25, 2018
Programming
0
45
go-critic
Oleg Kovalov
September 25, 2018
Tweet
Share
More Decks by Oleg Kovalov
See All by Oleg Kovalov
Hedged requests in Go
olegkovalov
0
120
Writing faster Redis client
olegkovalov
0
81
Moments before main()
olegkovalov
0
60
За пару мгновений до main() [RUS]
olegkovalov
1
560
Bencode - serializer and deserializer in Go
olegkovalov
0
480
impguard - protect your project structure
olegkovalov
0
620
Versioning
olegkovalov
0
91
Modifiability
olegkovalov
0
83
Server-Sent Events in Go
olegkovalov
0
750
Other Decks in Programming
See All in Programming
Amebaチョイス立ち上げの裏側 ~依存システムとの闘い~
daichi_igarashi
0
220
フロントエンドカンファレンス北海道2024 『小規模サイトでも使えるVite 〜HTMLコーディングをよりスマートに〜』長谷川広武(ハム)
h2ham
1
2.6k
KSPの導入・移行を前向きに検討しよう!
shxun6934
PRO
0
110
React + TextAliveでカッコいいLyric Applicatioinを作ろう!!
tosuri13
0
390
LangChainの現在とv0.3にむけて
os1ma
4
800
長期運用プロダクトの開発速度を維持し続けるためのリファクタリング実践例
wataruss
8
2.6k
Amazon BedrockでサーバレスなAIお料理ボットを作成する!!
tosuri13
0
160
私のEbitengineの第一歩
qt_luigi
0
440
Amazon Neptuneで始める初めてのグラフDB ー グラフDBを使う意味を考える ー
satoshi256kbyte
2
240
労務ドメインを快適に開発する方法 / How to Comfortably Develop in the Labor Domain
yuki21
1
250
月間4.5億回再生を超える大規模サービス TVer iOSアプリのリアーキテクチャ戦略 - iOSDC2024
techtver
PRO
1
750
いまから追い上げる、Jetpack Compose トレーニング
nyafunta9858
0
220
Featured
See All Featured
Docker and Python
trallard
39
3k
The World Runs on Bad Software
bkeepers
PRO
64
11k
Being A Developer After 40
akosma
83
580k
Atom: Resistance is Futile
akmur
261
25k
A Tale of Four Properties
chriscoyier
155
22k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
27
7.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
230
130k
Building Applications with DynamoDB
mza
89
6k
The Mythical Team-Month
searls
218
43k
Building Better People: How to give real-time feedback that sticks.
wjessup
359
18k
GitHub's CSS Performance
jonrohan
1029
450k
Making the Leap to Tech Lead
cromwellryan
128
8.8k
Transcript
Go-critic Static analysis in Go by Oleg Kovalov
Why static analysis? - Better code - Human friendly -
Optimal code Good examples: - golint - go vet - gometalinter - golangci-lint - go-critic
Project status - 58 checks implemented + 54 in current
todo - Optimistic merging (10+ contributors)
Types of analysis - Diagnostics - Suspicious code - Code
style - Can be more readable - Performance - Can be faster
Diagnostic check: nilValReturn
Code style check: namedConst
Performance check: indexAlloc
Go-toolsmith - astfmt - Print ast.Node with %s - astp
- Predicates for AST nodes - astcopy - Deep copy for AST nodes - astequal - Deep equal for AST nodes - astinfo - Useful AST information - strparse - Parse string to AST Clickable link: github.com/go-toolsmith
Demo: problem description - strings.Index("<long string>", "i") vs - strings.IndexByte("<long
string>", 'i') BenchmarkIndex-4 100000000 19.3 ns/op BenchmarkIndexByte-4 100000000 16.4 ns/op
Make a new rule - go get go-critic - make
new <checker_name> - adding code examples (positive & negative) - copy-pasting coding - adding docs - git push - .... - PROFIT Code: https://bit.ly/2NDbOtV
Trophies Our trophies collection: go-critic.github.io/trophies.html
Thank you - github.com/go-critic/go-critic - github.com/go-toolsmith - twitter.com/oleg_kovalov - github.com/cristaloleg