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
Takumasa Sakao
February 22, 2019
Programming
3.2k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
600
GCPをフル活用したゲームログ収集基盤の構築
sachaos
6
3.2k
Other Decks in Programming
See All in Programming
コンパウンドプロダクト開発のためのローカルプロセスマネージャー再発明 #layerxgo
izumin5210
0
160
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
260
30年振りにコンパイラの定数整数除算を改善した
herumi
9
4k
バグを直したら useEffect が消えた
colorful12
3
690
不幸な GC
chencmd
0
630
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
400
仕様駆動開発の消費期限
watany
20
8.9k
自動化したのに回らない テスト運用の壁―AI時代の品質責任と生産性
mfunaki
0
420
リアルな遅延を測る仕様
kota_yata
1
120
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
200
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
350
「人を評価する AI」の設計と実装
ryoyanara
0
230
Featured
See All Featured
Game over? The fight for quality and originality in the time of robots
wayneb77
1
250
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
420
Mind Mapping
helmedeiros
PRO
1
330
The Spectacular Lies of Maps
axbom
PRO
1
940
A Modern Web Designer's Workflow
chriscoyier
698
190k
Site-Speed That Sticks
csswizardry
13
1.5k
Navigating Weather and Climate Data
rabernat
0
490
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Deep Space Network (abreviated)
tonyrice
0
270
Faster Mobile Websites
deanohume
310
32k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
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