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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Oleg Kovalov
September 25, 2018
Programming
60
0
Share
go-critic
Oleg Kovalov
September 25, 2018
More Decks by Oleg Kovalov
See All by Oleg Kovalov
Embedded Postgres in Go
olegkovalov
0
30
Hedged requests in Go
olegkovalov
0
400
Writing faster Redis client
olegkovalov
0
210
Moments before main()
olegkovalov
0
110
За пару мгновений до main() [RUS]
olegkovalov
1
640
Bencode - serializer and deserializer in Go
olegkovalov
0
660
impguard - protect your project structure
olegkovalov
0
750
Versioning
olegkovalov
0
140
Modifiability
olegkovalov
0
140
Other Decks in Programming
See All in Programming
色即是空、空即是色、データサイエンス
kamoneggi
1
150
AlarmKitで明後日起きれるアラームアプリを作る
trickart
0
140
AI Agent と正しく分析するための環境作り
yoshyum
2
590
Transactional Change Stream Processing With Debezium and Apache Flink
gunnarmorling
1
120
ECR拡張スキャンでSBOMを収集して サプライチェーン攻撃の影響調査を 爆速で終わらせてみた
akihisaikeda
2
190
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
120
自動レビューエンジンの実装と運用 ~レビューのない世界へ~
kurukuru1999
2
250
AI駆動開発勉強会 広島支部 第一回勉強会 AI駆動開発概要とワークショップ
hayatoshimiu
0
360
UaaL×Androidアプリのメモリ計測 — Memory Profilerの先へ
rio432
0
170
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
5
610
リセットCSSを1行消したらアクセシビリティが向上した話
pvcresin
4
530
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
410
Featured
See All Featured
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
420
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Fireside Chat
paigeccino
42
3.9k
The SEO Collaboration Effect
kristinabergwall1
1
450
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Why Our Code Smells
bkeepers
PRO
340
58k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
370
Building an army of robots
kneath
306
46k
Deep Space Network (abreviated)
tonyrice
0
150
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
190
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
320
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