douhui3305 2018-06-07 12:48
浏览 34

travis找不到我的包裹golang

my structure project

currency-quote-api - 
                |
                |- scraping/ file.go
                |- api/ file.go
                |- tests/ test.go
                |- main.go

When I run the tests in travis CI i get the following error

tests/scraping_test.go:4:2: cannot find package "currency-quote-api/scraping" in any of:
/home/travis/.gimme/versions/go1.10.2.linux.amd64/src/currency-quote-api/scraping (from $GOROOT)
/home/travis/gopath/src/github.com/matheussilva97/currency-quote-api/Godeps/_workspace/src/currency-quote-api/scraping (from $GOPATH)
/home/travis/gopath/src/currency-quote-api/scraping

what I doing wrong?

my .travis.yml

sudo: false

language: go

go:
  -  1.10.2

notifications:
    email: false

before_script:
  - go get github.com/gorilla/mux
  - go get github.com/PuerkitoBio/goquery

script: 
  - go test -v ./tests/
  • 写回答

1条回答 默认 最新

  • duanci3845 2018-06-23 02:24
    关注

    Why not implicitly get all packages:

    before_script: - go get -t -v ./...

    For test, since each test can have its own dependency (depending on which package you put your test in), you should have a script like this:

    for d in $(go list ./... | grep -v vendor); do
      go test -race -coverprofile=profile.out -covermode=atomic $d
    done
    
    评论

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大