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
50
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
220
Writing faster Redis client
olegkovalov
0
120
Moments before main()
olegkovalov
0
65
За пару мгновений до main() [RUS]
olegkovalov
1
580
Bencode - serializer and deserializer in Go
olegkovalov
0
530
impguard - protect your project structure
olegkovalov
0
660
Versioning
olegkovalov
0
94
Modifiability
olegkovalov
0
84
Server-Sent Events in Go
olegkovalov
0
810
Other Decks in Programming
See All in Programming
Honoをフロントエンドで使う 3つのやり方
yusukebe
7
3.6k
Visual StudioのGitHub Copilotでいろいろやってみる
tomokusaba
1
220
Lambdaの監視、できてますか?Datadogを用いてLambdaを見守ろう
nealle
2
730
React 19アップデートのために必要なこと
uhyo
8
1.6k
Kotlinの開発でも AIをいい感じに使いたい / Making the Most of AI in Kotlin Development
kohii00
5
1.8k
Honoとフロントエンドの 型安全性について
yodaka
7
1.5k
SwiftUI移行のためのインプレッショントラッキング基盤の構築
kokihirokawa
0
170
iOSでQRコード生成奮闘記
ktcryomm
2
120
もう僕は OpenAPI を書きたくない
sgash708
6
1.9k
PRレビューのお供にDanger
stoticdev
1
240
ML.NETで始める機械学習
ymd65536
0
240
kintone開発を効率化するためにチームで試した施策とその結果を大放出!
oguemon
0
330
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
172
14k
RailsConf 2023
tenderlove
29
1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
For a Future-Friendly Web
brad_frost
176
9.6k
Testing 201, or: Great Expectations
jmmastey
42
7.2k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
The Cost Of JavaScript in 2023
addyosmani
47
7.4k
Raft: Consensus for Rubyists
vanstee
137
6.8k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.2k
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