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 の静的解析ツールの作成と活用
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Takumasa Sakao
February 22, 2019
Programming
3.1k
0
Share
Go の静的解析ツールの作成と活用
Takumasa Sakao
February 22, 2019
More Decks by Takumasa Sakao
See All by Takumasa Sakao
k9s のプラグイン機構とモダンな watch コマンド、viddy の紹介
sachaos
0
1.6k
Cloud Run でシェルスクリプトを動かす
sachaos
0
2.8k
GAE を利用したゲーム内通貨管理サービスの運用〜可用性を損なわないための工夫〜
sachaos
0
1.3k
レイトレーシングとGoroutine
sachaos
2
1.2k
OSSを作っている時に 考えていること ーUNIX哲学を添えてー
sachaos
2
590
GCPをフル活用したゲームログ収集基盤の構築
sachaos
6
3.2k
Other Decks in Programming
See All in Programming
Copilot CLI の継戦能力を高める コンテキスト管理
nozomutu
1
1.2k
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
160
エージェンティックRAGにAWSで入門しよう!
har1101
5
110
今さら聞けないCancellationToken
htkym
0
220
JavaDoc 再入門
nagise
0
260
oxlintはeslint/typescript-eslintを置き換えられるのか
shomafujita
2
310
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
170
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
180
作って学ぶ、 JSX (TSX) ランタイムの基本
syumai
7
1.5k
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
17
5.6k
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.4k
OSもどきOS
arkw
0
400
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Site-Speed That Sticks
csswizardry
13
1.2k
Are puppies a ranking factor?
jonoalderson
1
3.5k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
Making the Leap to Tech Lead
cromwellryan
135
9.9k
Building the Perfect Custom Keyboard
takai
2
780
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
The Cult of Friendly URLs
andyhume
79
6.9k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
200
The Cost Of JavaScript in 2023
addyosmani
55
10k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Transcript
Go Akatsuki Geek Live @sachaos
>/=& • @sachaos ( @) Twitter, GitHub
*B8 #% - • 2.: 61'< 4) 3 0; 3?+:C9 Go, GCP % %"$!7 • 5A>(% %,
Go 1.13 error
Go 1.13
Go 1.13
" !$ github.com/pkg/errors # ! &'!%
:smile:
== Wrap
== • == xerrors.Is
Wrap • Wrap
Wrap • Wrap
#* • ) => ' '&%'
• ("$ ! " )
($'" ) '"!# % & &
'"& Wikipedia
Go 714, • 714, parse AST %)$52
/ *'3 • Go +08 • Go '3 6#!"&( 8 AST %) go/ast $.- go/types SSA golang.org/x/tools/go/ssa golang.org/x/tools/go/analysis
github.com/sachaos/xerrchk == ! Wrap
== 1. AST (go/ast) 2.
error interface (go/types)
1. 2. error
0" Wrap '. • /) error #! *(return)1 Wrap (xerrors.Errorf(“wrap:
%w”, err)) 3- • ,+&2 <= Wrap Wrap error interface $ %(
return Wrap • MayFail1() err
• MayFail2() err Wrap • MayFail3 error Wrap • return Wrap MayFail3 err Wrap MayFail2 err
SSA • Static Single Assignment •
• golang.org/x/tools/go/ssa
return Wrap • return t3 t2,
t5 (φ) • t2 MayFail2 Wrap NG • t5 t4 Wrap OK
SSA • AST "!
#
• Go 1.13 error $%&#')*("-, 8 •
xerrors "0/. 7362" • 7362 Go 4+ • ! Qiita 1 4 "5 https://qiita.com/sachaos/items/f6b3e66931d7f73dd68d