Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

dep init fails if a required package is checked out in GOPATH with a version not in origin #373

Closed
spenczar opened this issue Apr 12, 2017 · 1 comment

Comments

@spenczar
Copy link
Contributor

At least, I think that's what's happening here.

This is with dep version 3ef7bf8.

In a project which uses github.com/golang/protobuf, I ran dep init. It errored with this message:


safe write of manifest and lock: error while writing out vendor tree: error while exporting github.com/golang/protobuf: fatal: failed to unpack tree object 32d172e1d23fd527e941c717dee7555aa5948b38
: exit status 128

I ran cd $GOPATH/src/github.com/golang/protobuf, and checked, and yes - I am checked out to that commit:

-> % git rev-parse HEAD
32d172e1d23fd527e941c717dee7555aa5948b38

This happens to be the SHA of the head commit of a branch I was working on, https://github.com/spenczar/protobuf/tree/codegen_convention. It's not yet in the upstream repo.

I ran git checkout master in $GOPATH/src/github.com/golang/protobuf, returned to the original project, ran dep init, and then everything was fine again.

I didn't expect that the state of packages in GOPATH would have an impact on how dep init works (I figured it would treat remotes as the authorities), so I'm making a bug report.

@sdboyer
Copy link
Member

sdboyer commented Apr 13, 2017

Thanks for the clear issue - we've got #216 open on this topic already, so closing 😄

We opted for this as an initial approach because it was the one most in line with vanilla Go users - that their GOPATH is the source of truth.

The WIP spec for the new behavior is in (the document linked from) #277.

@sdboyer sdboyer closed this as completed Apr 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants