我正在使用“google.golang.org/appengine/aetest”包并像這樣設置我的TestMain:var myAeInst aetest.Instancefunc TestMain(m *testing.M) { var err error myAeInst, err = aetest.NewInstance(&aetest.Options{StronglyConsistentDatastore: true}) defer tearDown() c := m.Run() os.Exit(code)}func tearDown() { if myAeInst != nil { myAeInst.Close() }}但是它卡在aetest.NewInstance,有人遇到過類似的問題嗎?
1 回答

慕尼黑的夜晚無繁華
TA貢獻1864條經驗 獲得超6個贊
您正在調用defer tearDown()
and then os.Exit(code)
,它tearDown
在之后 調用os.Exit
(即從不調用)。您需要顯式地調用tearDown
before os.Exit
,或者創建一個延遲的新函數,該函數不會調用os.Exit
.
- 1 回答
- 0 關注
- 199 瀏覽
添加回答
舉報
0/150
提交
取消