Wednesday, January 16, 2019

How To Deal With Dep Ensure Issue


When we create a new project in golang, we run "dep ensure" and get below error:
dep ensure
Solving failure: No versions of met constraints:
        master: unable to update checked out version: fatal: reference is not a tree: f8a0810f38afb8478882b3835a615aebfda39afa
: command failed: [git checkout f8a0810f38afb8478882b3835a615aebfda39afa]: exit status 128


Use "dep ensure -v"  to get debug information and find out which packages have check out issues
In this example,  has issues.

It is very likely  dep cache corrupted on this package when new version of our apps or tools being added 

We need to delete dep cache of

rm -rf  $GOPATH/go/dep/source/

rerun dep ensure