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.)

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

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)