"Tooling"
- 9.1 用 stdlib flag 寫 subcommand CLI
Go 的 flag 套件足以支撐多層 subcommand 的 CLI,不用過早引入 cobra;本章示範 main → cmd/ → internal/ 的標準 layout
- 1.1 Go 專案結構與 module
理解 go.mod、module path 與 Go 專案的依賴邊界
- 9.2 第三方 parser 整合:goldmark AST 入門
用 goldmark 把 markdown 解析成 AST,掌握 ast.Walk visitor 模式、block 與 inline 節點的判讀、byte offset 如何定位到行號
- 9.3 壓測工具選型
k6 / JMeter / Gatling / Locust / Vegeta / Production Replay 的工程選型
- 9.3 AST 驅動的 idempotent 文字改寫
用 AST 定位位置、用 line-based 或 byte-level 改寫;設計多條 rule 的執行順序;--check 跟 --fix 如何共用邏輯
- 9.4 跨檔案圖分析:從 lint 走到 static analysis
Single-file 規則用 AST 搞定;跨檔 orphan 偵測、broken link、backlink 完整性需要把整個 repo 建成圖再走訪。用 mdtools cards 為例
- 9.5 工具決策:regex 到 AST、Python 到 Go 的 tripwire
什麼訊號代表工具該升級到下一個層次;用 WRAP 框架做語言與實作層的技術決策;延遲決策的成本
- 9.6 Pre-commit hook 與 CI 整合
工具寫完只是起點;接到 pre-commit hook 跟 CI 才真正守住品質。Re-staging、dry-run vs apply、不能繞過的邊界
- 1.8 Go tooling 與日常開發流程
用 go run、go test、go fmt、go mod tidy 建立 Go 專案的基本工作節奏
- 3.9 flag、os/env 與設定邊界
用標準庫讀取設定,並把外部輸入轉成 config struct
- macOS 每個 App 到底吃多少空間:聚合佔用的 app-report 腳本
想知道「哪個 App 該清、清掉的是安全快取還是動不得的資料」時用 app-report 腳本。.app 大小會嚴重低估真實佔用,別照 /Applications 排序找大戶。
- macOS 新機基礎建設:套件管理與個人 bin 的設定順序
重灌或換機後底層基礎建設的依賴順序,免得後面工具裝不起來或路徑互相找不到。
- macOS 磁碟空間被吃光的診斷流程
Mac 空間莫名歸零、清 cache 沒救、或空間掉了又回來時的排查順序。避開 sparse 假大小和本地快照浮動的誤判。含 disk-report 腳本。
- flutter devices 卡住的訊號:device 數從 N 變 N-1 與 emulator 半活
`flutter devices` / `flutter run` 卡住又印 `Error -2 retrieving device properties` 時回來看。根因是 Android emulator 半活狀態,附恢復順序。
- 9.0 Go 在工具鏈生態的位置
後端服務以外,Go 常被用來寫 CLI、靜態分析、基礎設施客戶端。本章建立工具類 Go 程式跟服務類 Go 程式在結構、生命週期與錯誤處理上的分野