dongluan1743 2018-02-13 22:19
浏览 263
已采纳

Travis CI,“ go get -t./…”,并安装所有go依赖项

In the documentation here: https://docs.travis-ci.com/user/languages/go#Dependency-Management

This is the install dependencies step:

if go version is greater than or equal to 1.2

go get -t ./...

My project looks like this:

root
---- src
  ---- github.com
  ---- myProject
---- pkg

the GOPATH is set to root

but I am getting this error:

package github.com/aws/aws-lambda-go/lambda: home/travis/build/path/to/package exists but home/travis/build/path/to/package.git does not - stale checkout?

How do I get all the dependencies to install at once like an npm install in nodejs?

  • 写回答

1条回答 默认 最新

  • doubipiao1611 2018-02-13 22:38
    关注

    How do I get all the dependencies to install at once?

    That's what go get does... it looks like something might be misconfigured or corrupted in your case. You could start by trying some things.

    • go get installs into the first path in the $GOPATH environment variable. Confirm that it is set to what you want (usually a path ending in a directory named go; subdirs src, pkg, etc. will be created).

    • If you're going to use ./..., make sure you're calling go get from the right directory.

    • Check to make sure the git root is in the right place

    • try using a non-wildcard name/path/address for the package you want to get, instead of ./...

    • try calling go get without the -t flag

    If none of that works, you may be able to solve the problem by deleting the directory (home/travis/build/path/to/package) and trying again -- make sure you aren't deleting any code you worked on, or the git repository/files, unless it's backed up somewhere.

    According to Go tools documentation, you should only need to call

    go get [packages]
    

    to install the named packages along with their dependencies:

    Get downloads the packages named by the import paths, along with their dependencies. It then installs the named packages, like 'go install'.

    The ... ellipsis is a wildcard that can expand to match any string. See section on Description of Package Lists:

    An import path is a pattern if it includes one or more "..." wildcards, each of which can match any string, including the empty string and strings containing slashes. Such a pattern expands to all package directories found in the GOPATH trees with names matching the patterns.

    The ./ means "here": so make sure you're running from the right directory if you're going to use ./...

    The -t flag is for downloading the packages required to build the tests:

    The -t flag instructs get to also download the packages required to build the tests for the specified packages.

    The error you're seeing is related to git. Sometimes the cause is unknown, but it can often be fixed by deleting the directory and starting again (see, e.g., "Error to install golint" or "Correct way to get package")

    (You might also find this blog post on configuring travis-ci for Go helpful.)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:训练序列与输入层维度不一样
  • ¥15 关于Ubuntu20.04.3LTS遇到的问题:在安装完CUDA驱动后,电脑会进入卡死的情况,但可以通过键盘按键进入安全重启,但重启完又会进入该情况!
  • ¥15 关于#嵌入式硬件#的问题:树莓派第一天重装配置python和opencv后第二天打开就成这样,瞎捣鼓搞出来文件夹还是没把原来的界面调回来
  • ¥20 Arduino 循迹小车程序电路出错故障求解
  • ¥20 Arduino 循迹小车程序电路出错故障求解
  • ¥100 AT89C52单片机C语言调试之后再回答
  • ¥15 AT89C52单片机C语言串口助手发送数据包返回值
  • ¥15 C++数组中找第二小的数字程序纠错
  • ¥15 wannier复现图像时berry曲率极值点与高对称点严重偏移
  • ¥15 利用决策森林为什么会出现这样·的问题(关键词-情感分析)