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

Trying to vendor a package with a dependency to gopkg.in #1119

Closed
darren-west opened this issue Sep 4, 2017 · 3 comments · Fixed by #1132
Closed

Trying to vendor a package with a dependency to gopkg.in #1119

darren-west opened this issue Sep 4, 2017 · 3 comments · Fixed by #1132

Comments

@darren-west
Copy link

Hi,

I am trying to vendor a repository that has a dependency on hashicorp nomad project. I am getting issues with the dependency on gopkg.in and seem unable to solve them.

If i run dep init in my repository i get a Solve error and no generated files. i.e. there is no toml file or vendor file generated so i cannot edit the dependencies.

The error I get is:
No versions of gopkg.in/tomb.v2 met constraints: v1: Could not introduce gopkg.in/tomb.v2@v1, as its subpackage gopkg.in/tomb.v2 is missing. (Package is required by github.com/hashicorp/nomad@f-driver.)\

An example main.go that replicates this problem is:

package main

import (
	"github.com/hashicorp/nomad/api"
	"github.com/prometheus/common/log"
	"github.com/hashicorp/nomad/command"
)

func main() {
	client, err := api.NewClient(api.DefaultConfig())
	if err != nil {
		log.Fatal(err)
	}

	log.Info(command.JobGetter{})

	log.Info(client.Agent().NodeName())
}

What version of dep are you using (dep version)?

dep:
 version     : devel
 build date  :
 git hash    :
 go version  : go1.8.3
 go compiler : gc
 platform    : darwin/amd64

What dep command did you run?

dep init

What did you see instead?

No versions of gopkg.in/tomb.v2 met constraints: v1: Could not introduce gopkg.in/tomb.v2@v1, as its subpackage gopkg.in/tomb.v2 is missing. (Package is required by github.com/hashicorp/nomad@f-driver.)\

@sdboyer
Copy link
Member

sdboyer commented Sep 4, 2017

hi, welcome! thanks for posting an issue 😄

i think this may end up being addressed by #1053. though this error

No versions of gopkg.in/tomb.v2 met constraints: v1: Could not introduce gopkg.in/tomb.v2@v1, as its subpackage gopkg.in/tomb.v2 is missing. (Package is required by github.com/hashicorp/nomad@f-driver.)

is weird, because it indicates that the v1 branch is making it through on a gopkg.in v2 constraint. we reimplement gopkg.in's logic internally (it's the only way to map the semantics of that domain into dep's world of constraints and versions), and that just seems like a straight up bug?

if you could post the output of dep init -v, though, that'd be really helpful. if it's really long, a gist is preferred.

If i run dep init in my repository i get a Solve error and no generated files. i.e. there is no toml file or vendor file generated so i cannot edit the dependencies.

this is probably one of our top three issues right now - we need to give you at least something to work with on dep init failure, rather than just kicking you back to square one 😢 😢

@darren-west
Copy link
Author

Hi,

Thanks I have run this with dep init -v its in the gist here https://gist.github.com/darren-west/561525901184ff789ea4eb6dbe98a624

Thanks

@sdboyer
Copy link
Member

sdboyer commented Sep 6, 2017

thanks for the gist. i've replicated this locally - the problem appears to be that gopkg.in/tomb.{v1,v2} are ending up sharing a source repository, even though they should be treated separately. it's fine when we only use one of them, but when we use two, we end up getting one's data in the place of the other's. that's why v2 reports only having a v1 branch available - we already visited v1, so it won out.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants