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
サクッと作る静的解析ツール -importの依存制御ツールを作る-
Search
株式会社ビットキー / Bitkey Inc.
PRO
June 29, 2022
Technology
0
490
サクッと作る静的解析ツール -importの依存制御ツールを作る-
株式会社ビットキー / Bitkey Inc.
PRO
June 29, 2022
Tweet
Share
More Decks by 株式会社ビットキー / Bitkey Inc.
See All by 株式会社ビットキー / Bitkey Inc.
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
81
GORM v1 → v2に移行したときの変更点/Changes when moving from GORM v1 to v2
bitkey
PRO
1
44
うまくいく! を実現するための質問力 / It works! The Power of Questions to Make It Happen
bitkey
PRO
1
320
ビットキーの中核を担うプロダクトで テスト自動化を駆使して安定的なリリースを実現する/At the core of BitKey's products Achieving stable releases through the use of test automation
bitkey
PRO
1
83
共創するアーキテクチャ ~チーム全体で築く持続可能な開発エコシステム~ / Co-Creating Architecture - A Sustainable Development Ecosystem Built by the Entire Team
bitkey
PRO
2
5.7k
キャンセルします!処理を / Cancels the process!
bitkey
PRO
1
130
Waroomを使って ハードウェアからソフトウェアまで 領域横断してインシデントマネジメント始めてみた /I started incident management using Waroom across domains from hardware to software.
bitkey
PRO
1
120
データを用いてサービス品質の向上に貢献!! SREのプラクティスを用いた守りのデータ分析 / Using Data to Improve Service Quality! Defensive data analysis using SRE practices
bitkey
PRO
2
140
“共通化”で失敗したモデリング実例 / Modeling examples of failures due to "commonization
bitkey
PRO
3
210
Other Decks in Technology
See All in Technology
Amazon SageMaker Unified Studio(Preview)、Lakehouse と Amazon S3 Tables
ishikawa_satoru
0
150
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
100
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
110
TSKaigi 2024 の登壇から広がったコミュニティ活動について
tsukuha
0
120
5分でわかるDuckDB
chanyou0311
10
3.1k
Wantedly での Datadog 活用事例
bgpat
1
250
実務につなげる数理最適化
recruitengineers
PRO
6
620
セキュリティ系アップデート全体像と AWS Organizations 新ポリシー「宣言型ポリシー」を紹介 / reGrowth 2024 Security
masahirokawahara
0
390
目玉アップデート!のSageMaker LakehouseとUnified Studioは何たるかを見てみよう!
nayuts
0
250
[2024年12月版] Unity Catalogセットアップガイド / Unity Catalog Setup Guide
databricksjapan
0
130
バクラクのドキュメント解析技術と実データにおける課題 / layerx-ccc-winter-2024
shimacos
2
870
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
140
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Code Review Best Practice
trishagee
65
17k
Documentation Writing (for coders)
carmenintech
66
4.5k
Done Done
chrislema
181
16k
Designing Experiences People Love
moore
138
23k
Testing 201, or: Great Expectations
jmmastey
40
7.1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
GraphQLとの向き合い方2022年版
quramy
44
13k
Code Reviewing Like a Champion
maltzj
520
39k
Transcript
Bitkey Inc. Connect Product Noriki Takahashi αΫοͱ࡞Δ੩తղੳπʔϧ -import ͷґଘ੍ޚπʔϧΛ࡞Δ-
Outline 2 2 1. ࣗݾհ 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ 3. ܗੜπʔϧ: skeleton
4. ੩తղੳ༻ύοέʔδ: analysis 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 6. ·ͱΊ
1. ࣗݾհ 3 • ∁ڮయੜ(Noriki Takahashi) ◦ Twitter: @norinoriki0 ◦
GitHub: nrnrk • גࣜձࣾBitkey ◦ bitkey platform ͱ͍͏"ΧΪ"ͷϓϥοτϑΥʔϜͷ։ൃ • Go Ͱ GKE ্Ͱಈ͘APIαʔόʔͷ։ൃͳͲΛ͍ͯ͠·͢ • झຯ: ֶɾཧֶ ◦ zk-SNARKs ͷֶతͳଆ໘ΛטΈࡅ͘هࣄΛॻ͍ͨΓͯ͠·͢
1. ࣗݾհ 4 • ∁ڮయੜ(Noriki Takahashi) ◦ Twitter: @norinoriki0 ◦
GitHub: nrnrk • גࣜձࣾBitkey ◦ bitkey platform ͱ͍͏"ΧΪ"ͷϓϥοτϑΥʔϜͷ։ൃ • Go Ͱ GKE ্Ͱಈ͘APIαʔόʔͷ։ൃͳͲΛ͍ͯ͠·͢ • झຯ: ֶɾཧֶ ◦ zk-SNARKs ͷֶతͳଆ໘ΛטΈࡅ͘هࣄΛॻ͍ͨΓͯ͠·͢
1. ࣗݾհ 5
ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ 6 6
7 7 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ • Go ͷϞϊϨϙͷҰྫ
8 8 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ • Go ͷϞϊϨϙͷҰྫ go.mod ϑΝΠϧϨϙδτϦʹҰͭ →
Go Module ͕1ͭͷϞϊϨϙ
9 9 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ • Go ͷϞϊϨϙͷҰྫ ͍ΘΏΔϥΠϒϥϦ ؔߏମͳͲ͕ೖ͍ͬͯΔ ϞϊϨϙͷଞͷύοέʔδ͔Βར༻͞ΕΔ͜
ͱΛఆ
10 10 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ • Go ͷϞϊϨϙͷҰྫ ֤छαʔϏε HTTPαʔόʔgRPCαʔόʔͳͲ ଞ͔Β
import ͞Εͯ΄͘͠ͳ͍
11 11 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ • Go ͷϞϊϨϙͷҰྫ ࠔΔ͜ͱ ҙਤ͠ͳ͍ґଘ͕͋ͬͯϏϧυ͕௨Δ ྫ:
serviceB → serviceA
12 12 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ • Go ͷϞϊϨϙͷҰྫ ղܾํ๏͍͔ͭ͋͘Δ
13 13 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ • Go ͷϞϊϨϙͷҰྫ ղܾํ๏ᶃ internal ύοέʔδΛར༻
serviceA,B,C ͦΕͧΕͷύοέʔδͰެ։͠ ͨ͘ͳ͍ύοέʔδ internal ͷதʹೖΕΔ
14 14 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ • Go ͷϞϊϨϙͷҰྫ ղܾํ๏ᶃ internal ύοέʔδΛར༻
serviceA,B,C ͦΕͧΕͷύοέʔδͰެ։͠ ͨ͘ͳ͍ύοέʔδ internal ͷதʹೖΕΔ → ڞ௨ར༻͢ΔͷϥΠϒϥϦͱͯ͠Γ ग़͢ͷͰɺશ෦ internal ͷதʹೖΕΔ͜ͱʹ...
15 15 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ • Go ͷϞϊϨϙͷҰྫ ղܾํ๏ᶄ Go Module
ͷׂ serviceA,B,C ҎԼʹ go.mod Λ͓͍ͯผͷϞ δϡʔϧͱΈͳ͢
16 16 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ • Go ͷϞϊϨϙͷҰྫ ղܾํ๏ᶄ Go Module
ͷׂ serviceA,B,C ҎԼʹ go.mod Λ͓͍ͯผͷϞ δϡʔϧͱΈͳ͢ → ཧ͕ࡶʹͳΔͷͰආ͚͍ͨ
17 17 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ • Go ͷϞϊϨϙͷҰྫ ղܾํ๏ᶃɺᶄඪ४తͳํ๏͕ͩɺզʑʹ ϑΟοτ͠ͳ͍...
18 18 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ • Go ͷϞϊϨϙͷҰྫ ղܾํ๏ᶅ linter Ͱ੍ޚ
ύοέʔδؒͷґଘΛνΣοΫͯ͠CIͳͲͰ੍ ޚͰ͖ΔΑ͏ʹ͢Δ
19 19 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ • Go ͷϞϊϨϙͷҰྫ ղܾํ๏ᶅ linter Ͱ੍ޚ
ύοέʔδؒͷґଘΛνΣοΫͯ͠CIͳͲͰ੍ ޚͰ͖ΔΑ͏ʹ͢Δ → ͪΐͬͱअಓͬΆ͍͕ɺࠓճ͜ΕΛࢼ͢
ґଘੑΛνΣοΫ͢ΔΑ͏ͳ linter Λ୳ͦ͏ 20 20 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ
͏ʔΜɺɺɺͳ͍ 21 21 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ
ࣗ࡞ linter Ͱ͍͔͘... 22 22 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ
Ͱ੩తղੳ͔ɺ ͳΜ͔େมͦ͏ͩͳ 23 23 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ
ͱࢥͬͪΌ͍·ͨ͠ 24 24 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ
͕ɺ͔͠͠ 25 25 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ
࣮ࡍʹͬͯΈΔͱ݁ߏ؆୯ʂ 26 26 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ
skeleton (ܗੜπʔϧ) ४ެࣜͷ analysis ύοέʔδͷ ͓͔͛Ͱ؆୯ʹαΫοͱ࡞Εͨ 27 27 2. ϞϊϨϙ։ൃͰؾʹͳΔ͜ͱ
ܗੜπʔϧ: skeleton 28 28
• skeleton Goͷ੩తղੳπʔϧͷͨΊͷܗΛੜͯ͘͠ΕΔπʔϧ ԼهίϚϯυͰΠϯετʔϧͰ͖·͢ go install github.com/gostaticanalysis/skeleton/v2@latest 3. ܗੜπʔϧ: skeleton
29
• skeleton 30 3. ܗੜπʔϧ: skeleton
• skeleton 31 module ໊Λࢦఆͯ͠ܗ(εέϧτϯ) Λੜ 3. ܗੜπʔϧ: skeleton
• skeleton 32 ίϚϯυ࣮ߦ༻ͷϩδοΫ ͓ܾ·ΓͷϩδοΫ͕͋Δ 3. ܗੜπʔϧ: skeleton
• skeleton 33 ղੳ༻ͷϩδοΫΛఆٛ ࠷ݶ͜͜ʹϩδοΫΛॻ͚ͩ͘Ͱ OK 3. ܗੜπʔϧ: skeleton
• skeleton 34 ୯ମςετ 3. ܗੜπʔϧ: skeleton
• skeleton 35 ୯ମςετ༻ͷσʔλ ੩తղੳͳͷͰ ςετ༻σʔλ = ιʔείʔυ 3. ܗੜπʔϧ:
skeleton
੩తղੳ༻ύοέʔδ: analysis 36 36
• analysis ύοέʔδ ◦ ੩తղੳ༻ͷ"४ެࣜ"ύοέʔδ (golang.org/x/tools/go/analysis) ▪ → ੩తղੳʹ͓͚ΔϝΠϯͷϩδοΫ͚ͩʹूதͰ͖Δ 4.
੩తղੳ༻ύοέʔδ: analysis 37
• analysis ύοέʔδ ◦ ੩తղੳ༻ͷ"४ެࣜ"ύοέʔδ (golang.org/x/tools/go/analysis) ▪ → ੩తղੳʹ͓͚ΔϝΠϯͷϩδοΫ͚ͩʹूதͰ͖Δ ◦
ಛ ▪ Analyzer ߏମͰ੩తղੳͷ݁Ռͷ࠶ར༻͕؆୯ʹ 4. ੩తղੳ༻ύοέʔδ: analysis 38
• analysis ύοέʔδ ◦ ੩తղੳ༻ͷ"४ެࣜ"ύοέʔδ (golang.org/x/tools/go/analysis) ▪ → ੩తղੳʹ͓͚ΔϝΠϯͷϩδοΫ͚ͩʹूதͰ͖Δ ◦
ಛ ▪ Analyzer ߏମͰ੩తղੳͷ݁Ռͷ࠶ར༻͕؆୯ʹ ◦ ઌఔͷ skeleton Ͱੜ͞ΕͨίʔυͰΘΕ͍ͯΔ 4. ੩తղੳ༻ύοέʔδ: analysis 39
• Analyzer ߏମ(࠶ར༻ͳ͠ͷ࠷γϯϓϧͳྫ) 4. ੩తղੳ༻ύοέʔδ: analysis 40 mylinter.go
• Analyzer ߏମ(࠶ར༻ͳ͠ͷ࠷γϯϓϧͳྫ) 4. ੩తղੳ༻ύοέʔδ: analysis 41 analyzer ͷ໊শ (≒
linter ͷ໊শ) mylinter.go
• Analyzer ߏମ(࠶ར༻ͳ͠ͷ࠷γϯϓϧͳྫ) 4. ੩తղੳ༻ύοέʔδ: analysis 42 υΩϡϝϯτ analyzer ʹ͍ͭͯͷ
આ໌ mylinter.go
• Analyzer ߏମ(࠶ར༻ͳ͠ͷ࠷γϯϓϧͳྫ) 4. ੩తղੳ༻ύοέʔδ: analysis 43 ղੳ༻ϩδοΫ → ࠷ݶɺ͜͜ʹϩ
δοΫॻ͚ͩ͘Ͱ OK mylinter.go
• Analyzer ߏମ ͷ࠶ར༻ • Analyzer ߏମΛఆٛ͢Δࡍʹɺଞͷ Analyzer Λར༻͢Δ͜ͱ͕Ͱ͖Δ 4.
੩తղੳ༻ύοέʔδ: analysis 44
• Analyzer ߏମ ͷ࠶ར༻ • Analyzer ߏମΛఆٛ͢Δࡍʹɺଞͷ Analyzer Λར༻͢Δ͜ͱ͕Ͱ͖Δ •
ྫ: golang.org/x/tools/go/analysis/passes/inspect.Analyzer Λ༻͍ͯϊʔ υͷϑΟϧλϦϯά 4. ੩తղੳ༻ύοέʔδ: analysis 45
• Analyzer ߏମ ͷ࠶ར༻ • Analyzer ߏମΛఆٛ͢Δࡍʹɺଞͷ Analyzer Λར༻͢Δ͜ͱ͕Ͱ͖Δ •
ྫ: golang.org/x/tools/go/analysis/passes/inspect.Analyzer Λ༻͍ͯϊʔυ ͷϑΟϧλϦϯά 4. ੩తղੳ༻ύοέʔδ: analysis 46 Analyzer ͷ࠶ར༻ͷ؆୯ͳྫͱͯ͠ɺ ࣝผࢠ͕ "gopher" ͱͳ͍ͬͯΔͷΛݟ͚ͭΔ࣮ྫΛݟͯΈΔ → ࣍ͷεϥΠυ ※ skeleton ͔Βੜ͞ΕΔαϯϓϧ
4. ੩తղੳ༻ύοέʔδ: analysis 47
4. ੩తղੳ༻ύοέʔδ: analysis 48 mylinter.go
4. ੩తղੳ༻ύοέʔδ: analysis 49 ࠶ར༻͢Δ Analyzer Λఆٛ ͜͜ͰɺAST ݕࠪ༻ ͷ
Analyzer Λར༻ golang.org/x/tools/go/ analysis/passes/ inspect mylinter.go
4. ੩తղੳ༻ύοέʔδ: analysis 50 run ͷதͰ inspect.Analyzer ͷग़ ྗ͢Δ݁ՌΛར༻ mylinter.go
4. ੩తղੳ༻ύοέʔδ: analysis 51 ast.Ident (Identifier = ࣝผࢠ) ͷΈʹߜΔͨ ΊͷϑΟϧλ
mylinter.go
4. ੩తղੳ༻ύοέʔδ: analysis 52 inspect Λར༻ͯ͠ ast.Ident ͷΈʹߜͬͯ ॲཧ͢Δ ଞͷ
AST ͷϊʔυ͕ དྷͨͱ͖ͷॲཧΛॻ͔ ͳͯ͘ྑ͍ʂ mylinter.go
4. ੩తղੳ༻ύοέʔδ: analysis 53 ಠࣗͷϩδοΫ͜͜ ͚ͩ analysis ύοέʔδΛ ͏͜ͱͰ͜͜ʹ͚ͩ ूத͢Δ͜ͱ͕Ͱ͖Δ
mylinter.go
• [༨ஊ] inspect Analyzer ͷఆٛ 4. ੩తղੳ༻ύοέʔδ: analysis 54
• [༨ஊ] inspect Analyzer ͷఆٛ 4. ੩తղੳ༻ύοέʔδ: analysis 55 ͜͜Ͱ࠶ར༻͢Δ݁Ռͷ
ܕΛఆٛ
ύοέʔδґଘ੍ޚπʔϧ࣮ 56 56
• ύοέʔδґଘ੍ޚπʔϧ(banimport)࣮ ◦ ࣮ݱ͍ͨ͜͠ͱ ▪ ύοέʔδؒͷґଘΛ੍ޚ͍ͨ͠ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 57
• ύοέʔδґଘ੍ޚπʔϧ(banimport)࣮ ◦ ࣮ݱ͍ͨ͜͠ͱ ▪ ύοέʔδؒͷґଘΛ੍ޚ͍ͨ͠ ◦ ༷ ▪ ېࢭ͢Δґଘ͕͋ͬͨΒՕॴΛಛఆͯ͠ΤϥʔΛฦ͢
▪ ઃఆϑΝΠϧ (.banimport.json) • ېࢭ͢Δґଘͷjsonఆٛ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 58
• ᶃ skeleton Ͱܗ࡞ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 59
• ᶄ ςετ࡞ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 60
• ᶄ ςετ࡞ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 61 ςετσʔλ࡞ → ࠓճෳͷύοέʔδͷґଘؔ ͷςετ͕͍ͨ͠ͷͰߏΛগ͠มߋ
• ᶄ ςετ࡞ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 62 ෦ʹෳͷύοέʔδ͕͋Δ͜ͷ ·ͱ·ΓΛҰͭͷσʔληοτͱ͢ Δ
• ᶄ ςετ࡞ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 63 ͜Ε svca, svcb, svcc
͔Βར༻͞ ΕͯOK
• ᶄ ςετ࡞ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 64 ͜͜ͷؒͰґଘΛ࣋ͨͳ͍Α͏ͳ ϧʔϧʹ͢Δ
• ᶄ ςετ࡞ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 65 testdata/src/a/srcb/ main.go testdata/src/a/srcc/main.go
• ᶄ ςετ࡞ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 66 svcb → svcc ʹґଘΛ͓ͨͤͯ͘
→ ͜ΕΤϥʔͱͯ͠ݕग़͢Δ testdata/src/a/srcb/ main.go testdata/src/a/srcc/main.go
• ᶄ ςετ࡞ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 67 ίϝϯτͰϝοηʔδͷظΛهࡌ // want <͜͜ʹهࡌ>
← analysistest ύοέʔδ͕ղऍ testdata/src/a/srcb/ main.go testdata/src/a/srcc/main.go
• ᶄ ςετ࡞: ઃఆϑΝΠϧ࡞ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 68 ઃఆϑΝΠϧΛ࡞ Ͳͷύοέʔδ͔ΒͲͷ ύοέʔδʹґଘΛ࣋ͨͳ
͍Α͏ʹ͢Δ͔Λઃఆ .banimport.json
• ᶄ ςετ࡞: ઃఆϑΝΠϧ࡞ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 69 svca ͔Β svcb,
sbcc ʹґଘ Λ࣋ͨͳ͍Α͏ʹ͢Δ .banimport.json
• ᶄ ςετ࡞: ઃఆϑΝΠϧ࡞ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 70 svca, svcb, svcc
૬ޓʹґ ଘΛ͍͚࣋ͬͯͳ͍ .banimport.json
• ᶄ ςετ࡞: ςετͷ࣮ߦ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 71 ςετͷ࣮ߦ
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 72 banimport_test.g o
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 73 ςετͷσʔληοτΛϧʔϓ (b, c ͷςετσʔλՃ) banimport_test.g o
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 74 analysistest ͷσϑΥϧτͷ testadata ύε banimport_test.g o
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 75 import ͷґଘېࢭͷઃఆϑΝΠϧͷಡΈࠐΈ banimport_test.g o
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 76 import ͷґଘېࢭͷઃఆΛϑϥάͱͯ͢͠(࣍ͷᶅ࣮ Ͱհ) banimport_test.g o
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 77 ςετσʔλΛࢦఆ࣮ͯ͠ߦ banimport_test.g o
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 78 ςετΛߦ͏ Analyzer Λࢦఆ banimport_test.g o
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 79 ղੳ͢ΔରͷύοέʔδΛࢦఆ banimport_test.g o
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 80 testdata ͷதͰظ(want)Λॻ͘ͷͰ͜͜ͷϩδοΫεοΩϦʂ banimport_test.g o
• ᶅ ࣮ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 81 ϝΠϯͱͳΔϩδοΫΛॻ͘
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 82 banimport.go
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 83 Analyzer ͷఆٛ import ͔͠ݟͳ͍ͷͰ ґଘͳ͠ banimport.go
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 84 ϑϥάҾͷఆٛ flags ύοέʔδͱಉͷ ܗͰఆٛՄೳ banimport.go
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 85 run ؔ ϝΠϯͷॲཧΛߦ͏ؔ → ࣍ͷεϥΠυ banimport.go
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 86 banimport.go
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 87 ઃఆ jsonͷύʔε banimport.go
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 88 ֤ϑΝΠϧͷ import ఆٛͷΈॲ ཧ͢Δ banimport.go
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 89 import ͷύεΛऔಘ ※ จࣈྻϦςϥϧ͕ Value ʹೖ͍ͬͯΔͷͰ Unquote
͕ඞཁ banimport.go
5. ύοέʔδґଘ੍ޚπʔϧ࣮ 90 ېࢭ͢Δґଘ͕ݟ ͔ͭͬͨ߹ɺ ϝοηʔδΛग़͢ banimport.go
• ᶆ ಈ࡞֬ೝ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 91
• ᶆ ಈ࡞֬ೝ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 92
• ᶆ ಈ࡞֬ೝ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 93
• ᶆ ಈ࡞֬ೝ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 94
• ᶆ ಈ࡞֬ೝ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 95
• ᶆ ಈ࡞֬ೝ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 96
• ᶆ ಈ࡞֬ೝ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 97
• ᶆ ಈ࡞֬ೝ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 98 ग़ྗ݁Ռ
• ᶆ ಈ࡞֬ೝ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 99 ग़ྗ݁Ռ
• ᶆ ಈ࡞֬ೝ 5. ύοέʔδґଘ੍ޚπʔϧ࣮ 100 ग़ྗ݁Ռ testdata/src/a/srcb/ main.go
5. ύοέʔδґଘ੍ޚπʔϧ࣮ ϞϊϨϙͰύοέʔδґଘͷ੍ޚ͕ Ͱ͖ΔΑ͏ʹͳͬͨʂʂ
5. ύοέʔδґଘ੍ޚπʔϧ࣮ skeleton Λ͑αΫοͱ࡞ΕΔʂ
5. ύοέʔδґଘ੍ޚπʔϧ࣮ ͪ͜Β https://github.com/nrnrk/banimport
·ͱΊ 104 104
• ·ͱΊ ◦ skeleton ΛͬͯαΫοͱ੩తղੳπʔϧ͕࡞ΕΔʂ ◦ ϞϊϨϙͳͲͰύοέʔδؒͷґଘΛ੍ޚ͍ͨ͠߹ ▪ ͞Βʹɺinternal ύοέʔδͷར༻Ϟδϡʔϧͷׂ͕ϑΟοτ͠ͳ͍߹
▪ → banimport Λͬͯύοέʔδؒͷґଘ੍ޚΛࢼ͢Ձ͋Γʂ ▪ CI ͳͲʹΈࠐΉͱޡͬͨ import ͕͛Δ ◦ ͦͷଞ ▪ skeleton ͷຊޠ README ▪ Go ͷ AST ͷೖతͳ༰ʹ͍ͭͯͷաڈͷൃද (એ) 105 6. ·ͱΊ