doujiao4710 2016-07-20 10:37
浏览 59

如何在travis-ci上管理构建golang项目

I'm developing Golang project and using TravisCI. As dependency tool, Godeps is used.

After running test by git push, something error was happened as below.

# command-line-arguments
cmd/proj/main_test.go:6:2: cannot find package 
"command-line-/vendor/github.com/xxxxx/xxxxx/abc" in any of:
/home/travis/.gimme/versions/go1.6.linux.amd64/src/command-line-/vendor/github.com/xxxxx/xxxxx/xxx 

Why it can't find package? As build log, it seems to work well by go get command.

My travis.yml is here.

language: go
sudo: false
go:
  - 1.6
  - tip

services:
  - redis-server

env:
  global:
    - secure: "xxxxx"

script:
  - go fmt ./...
  - go vet $(go list ./... | grep -v /vendor/)
  - go test -v cmd/xxxx/*.go -xxxx ${XXXXX}

before_install:
  - go get github.com/tools/godep

branches:
  only:
    - master

tip of go version is OK. But 1.6 or 1.5 version can't run well.

How can I manage that situation?

  • 写回答

1条回答 默认 最新

  • ds0678 2016-07-20 10:49
    关注

    The way Go 1.6 manages dependencies is different than Go 1.5 and previous versions.

    1.6 introduces the /vendor folder. Whenever you import a dependency, if the library exists in /vendor, then the library is loaded.

    The behavior was introduced in 1.5, but in that version it was experimental. It means that you need to enable it using the GO15VENDOREXPERIMENT=1 environment variable.

    If you only need to provide support for 1.5 and 1.6, then simply add the variable to Travis when building 1.5 projects.

    If you need to extend support also for versions before 1.5, then it's a little bit more complicated.

    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)