hitochan
hitochan

Reputation: 1068

"glide get" and "go get" install different versions

I use ginkgo for the test tool, and glide for the package manager.

ginkgo requires that we install a binary to generate test files automatically. glide, to the best of my knowledge, does not support the installation of binaries. So, I ended up using go get to install the binary, along with its source files.

A problem is that glide installs all the packages that it resolves by scanning the go files. This means that the source files of ginkgo are also installed. During the compilation, the packages in vendor directory is prioritized. So this causes the situation where binary from $GOPATH/bin is used, and source files from vendor directory are used. And it seems that go get fetches files from master branch, where as glide fetches the latest released version. So the test files that are generated by the binary is not compatible with the source files installed by glide.

Is there any way to prevent glide from installing some specific packages? Or are there any other better ways?

Upvotes: 0

Views: 2056

Answers (1)

JanB
JanB

Reputation: 46

With glide you can specify a certain version of the package you want to install. This is done in the glide.yaml

TIP: The version is either VCS dependent and can be anything that can be checked out or a semantic version constraint that can be parsed by the github.com/ Masterminds/semver package. For example, with Git this can be a branch, tag, or hash. This varies and depends on what's supported in the VCS.

package: github.com/YOUR/PACKAGE
import:
  - package: github.com/onsi/ginkgo/ginkgo
    version: master
    repo: [email protected]:onsi/ginkgo.git

This will download the latest master commit.

Here are further information about versioning with glide.

Upvotes: 2

Related Questions