我使用以下命令為特定包運行測試go test fts -run run_test.go無法加載包:包 fts:在以下任何一個中都找不到包“fts”:/usr/local/Cellar/go/1.11.1/libexec/src/integration(來自 $GOROOT)/Users/i055555/go/src /fts(來自 $GOPATH)包裹看起來像gitproj/ |---- fts |---- -command |---- -run.go |---- -run_test.go |---- internal |---- -fs.go |---- -tb.go |---- -tb_test.go main.go
1 回答

人到中年有點甜
TA貢獻1895條經驗 獲得超7個贊
因此,您可以go test
通過為其指定相對路徑來運行特定包:
go test ./fts/command
該--run
標志采用正則表達式,有助于指示將在包中運行哪些測試。
例如,如果您有一個名為 的測試TestFoo(...)
和另一個TestBar(...)
. go test --run=TestFoo
只會運行TestFoo(...)
。
- 1 回答
- 0 關注
- 173 瀏覽
添加回答
舉報
0/150
提交
取消