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
44
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
69
Writing faster Redis client
olegkovalov
0
55
Moments before main()
olegkovalov
0
56
За пару мгновений до main() [RUS]
olegkovalov
1
550
Bencode - serializer and deserializer in Go
olegkovalov
0
420
impguard - protect your project structure
olegkovalov
0
580
Versioning
olegkovalov
0
84
Modifiability
olegkovalov
0
76
Server-Sent Events in Go
olegkovalov
0
700
Other Decks in Programming
See All in Programming
CircleCIを活用して AWSへの継続的デリバリーを 実践する
coconala_engineer
1
230
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
120
Folding Cheat Sheet #2
philipschwarz
PRO
0
110
甘い香りに誘われてVanilla Extractを1年間運用してみた
miyahkun
1
110
Ruby GitHub Packages
bkuhlmann
0
620
Blue/Greenデプロイの導入による 運用フローの改善
kudoas
1
360
From Spring Boot 2 to Spring Boot 3 with Java 22 and Jakarta EE
ivargrimstad
0
920
スクラムチームと認知負荷 - ニフティのスクラムトーク Vol2. / NIFTY Tech Talk #18
niftycorp
PRO
1
120
1인 개발자로 행복하게 살기 - GDG 송도 헬로월드 2024
benjaminkim
1
5.6k
PHP8.3の機能を振り返る / Review of PHP 8.3 features
seike460
PRO
1
110
ONE WEDGE_company_guide
1wedge_one
0
380
Zero Waste, Radical Magic, and Italian Graft – Quarkus Efficiency Secrets
hollycummins
0
220
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
513
39k
Facilitating Awesome Meetings
lara
41
5.6k
Scaling GitHub
holman
457
140k
GraphQLの誤解/rethinking-graphql
sonatard
50
9.2k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
18
6.9k
Building Adaptive Systems
keathley
30
1.8k
4 Signs Your Business is Dying
shpigford
175
21k
Mobile First: as difficult as doing things right
swwweet
216
8.6k
What’s in a name? Adding method to the madness
productmarketing
PRO
15
2.6k
Six Lessons from altMBA
skipperchong
20
3k
We Have a Design System, Now What?
morganepeng
42
6.7k
Unsuck your backbone
ammeep
662
57k
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