dtz33344 2017-01-13 02:33
浏览 98

由于根路径已更改,go测试失败

I am running go test -v $(go list ./... | grep -v /vendor/) to run all tests excluding vendor. My file structure is

myRepo
  api
    user_test.go
  config
    key.json
  main.go

I have key.json file under config folder for maintianing all api keys. I am using filepath.Abs to load key.json file. Everything is working fine except when I run tests. When I run go tests the root path is changing to myRepo/api and the error I am getting is unable to find myRepo/api/config/key.json

  • 写回答

0条回答 默认 最新

    报告相同问题?