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 MCNP里如何定义多个源?
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏