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
51
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
290
Writing faster Redis client
olegkovalov
0
150
Moments before main()
olegkovalov
0
78
За пару мгновений до main() [RUS]
olegkovalov
1
600
Bencode - serializer and deserializer in Go
olegkovalov
0
570
impguard - protect your project structure
olegkovalov
0
700
Versioning
olegkovalov
0
110
Modifiability
olegkovalov
0
100
Server-Sent Events in Go
olegkovalov
0
850
Other Decks in Programming
See All in Programming
AI Agents: How Do They Work and How to Build Them @ Shift 2025
slobodan
0
110
Reading Rails 1.0 Source Code
okuramasafumi
0
250
個人軟體時代
ethanhuang13
0
330
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
110
🔨 小さなビルドシステムを作る
momeemt
4
690
AIでLINEスタンプを作ってみた
eycjur
1
230
時間軸から考えるTerraformを使う理由と留意点
fufuhu
16
4.8k
How Android Uses Data Structures Behind The Scenes
l2hyunwoo
0
480
rage against annotate_predecessor
junk0612
0
170
「手軽で便利」に潜む罠。 Popover API を WCAG 2.2の視点で安全に使うには
taitotnk
0
870
Putting The Genie in the Bottle - A Crash Course on running LLMs on Android
iurysza
0
140
Platformに“ちょうどいい”責務ってどこ? 関心の熱さにあわせて考える、責務分担のプラクティス
estie
1
150
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
135
9.5k
Building Adaptive Systems
keathley
43
2.7k
4 Signs Your Business is Dying
shpigford
184
22k
Documentation Writing (for coders)
carmenintech
74
5k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
Practical Orchestrator
shlominoach
190
11k
Six Lessons from altMBA
skipperchong
28
4k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Automating Front-end Workflow
addyosmani
1370
200k
Producing Creativity
orderedlist
PRO
347
40k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
A better future with KSS
kneath
239
17k
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