About Glide update

My computer develop environment

1
2
3
4
5
6
7
8
9
10
$ sw_vers 
ProductName: Mac OS X
ProductVersion: 10.12.6
BuildVersion: 16G29

$ go version
go version go1.8.3 darwin/amd64

$ glide -v
glide version 0.12.3

Use glide to import dependence packages

1
$ glide get "github.com/sirupsen/logrus"

Because the package github.com/sirupsen/logrus has imported the golang office package golang.org/x/crypto,
which has been moved to github anymore

When updating the project ‘s dependence packages, it always notice that the crypto package cannot been found then interrupted update

The old way is to download the package below the $GOPATH directory,
then running update to skip this package

1
2
3
4
5
$ mkdir -p $GOPATH/src/golang.org/x/
$ git clone https://github.com/golang/crypto.git $GOPATH/src/golang.org/x/crypto
$ git clone https://github.com/golang/sys.git $GOPATH/src/golang.org/x/sys

$ glide up

This method is quiet convenient, but each deployment of a server, the workload will increase, so there is a new way.

  • Fork the project github.com/sirupsen/logrus to my own github, update the github repo address in my project
  • Replace the github repo in project glide config file
  • Update the dependency package glide up

But in the process of updating ,package golang.org/x/crypto still be prompted to import in a new git warehouse

In order to exclude the influence of other third party packages, so I created a new project

1
2
3
4
$ cd $GOPATH/src/
$ mkdir test;cd test
$ glide init
$ glide get https://github.com/liyuliang2013/logrus.git

After check the code in the new repository, I found the code does not been modify !!
But git clone this new warehouse, the code is indeed modified, why is this??

Check glide’s explanation:
issue 330
issue 726

ok,we changed the glide configuration file

1
2
import:
- package: github.com/sirupsen/logrus

to

1
2
3
4
5
import:
- package: github.com/sirupsen/logrus
repo: https://github.com/liyuliang2013/logrus.git
vcs: git
version: master

Then the glide will download the package basing on the repo actual address

Share