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

packages are missing #674

Closed
aviau opened this issue May 29, 2017 · 4 comments
Closed

packages are missing #674

aviau opened this issue May 29, 2017 · 4 comments

Comments

@aviau
Copy link

aviau commented May 29, 2017

Hello!

There are missing packages when I use dep init, then dep ensure and try to build.

Here is how to reproduce:

Create test.go:

package test

import (
  "testing"
  "github.com/stretchr/testify/assert"
)

func TestSomething(t *testing.T) {

  var a string = "Hello"
  var b string = "Hello"

  assert.Equal(t, a, b, "The two words should be the same.")

}

Build it...

aviau@cranberry:~/go/src/github.com/lanets/test$ go build ./...
aviau@cranberry:~/go/src/github.com/lanets/test$ 

That works!

Now lets vendor my deps:

aviau@cranberry:~/go/src/github.com/lanets/test$ dep init
Searching GOPATH for projects...
  Using master as constraint for direct dep github.com/stretchr/testify
  Locking in master (4d4bfba) for direct dep github.com/stretchr/testify
  Locking in v1.1.0 (346938d) for transitive dep github.com/davecgh/go-spew
Following dependencies were not found in GOPATH. Dep will use the most recent versions of these projects.
  github.com/pmezard/go-difflib
aviau@cranberry:~/go/src/github.com/lanets/test$ dep ensure

and build...

aviau@cranberry:~/go/src/github.com/lanets/test$ go build ./...
vendor/github.com/stretchr/testify/mock/mock.go:14:2: cannot find package "github.com/stretchr/objx" in any of:
	/home/aviau/go/src/github.com/lanets/test/vendor/github.com/stretchr/objx (vendor tree)
	/usr/lib/go-1.7/src/github.com/stretchr/objx (from $GOROOT)
	/home/aviau/go/src/github.com/stretchr/objx (from $GOPATH)
aviau@cranberry:~/go/src/github.com/lanets/test$ 

My Gopkg.toml

[[constraint]]
  name = "github.com/pmezard/go-difflib"
  version = "1.0.0"

[[constraint]]
  branch = "master"
  name = "github.com/stretchr/testify"

Gopkg.lock:

[[projects]]
  name = "github.com/davecgh/go-spew"
  packages = ["spew"]
  revision = "346938d642f2ec3594ed81d874461961cd0faa76"
  version = "v1.1.0"

[[projects]]
  name = "github.com/pmezard/go-difflib"
  packages = ["difflib"]
  revision = "792786c7400a136282c1664665ae0a8db921c6c2"
  version = "v1.0.0"

[[projects]]
  branch = "master"
  name = "github.com/stretchr/testify"
  packages = ["assert"]
  revision = "4d4bfba8f1d1027c4fdbe371823030df51419987"

[solve-meta]
  analyzer-name = "dep"
  analyzer-version = 1
  inputs-digest = "229b117ce0bc14efdd38d21bce5bb75f2ab67db1a949fb886bad21a4be0fc614"
  solver-name = "gps-cdcl"
  solver-version = 1

It looks like go deps is not downloading github.com/stretchr/objx, which it should.

Note that this package looks like its vendored by github.com/stretchr/testify here: https://github.com/stretchr/testify/tree/master/vendor/github.com/stretchr/objx

@aviau
Copy link
Author

aviau commented May 29, 2017

BTW, is there a workaround for this until it is fixed?

@gregory-m
Copy link
Contributor

You don't use mock package in your code so yep doesn't bring its dependencies.

./... in go also mean vendor folder see golang/go#11659

You don't need to build packages in vendor just use go build $(go list ./... | grep -v '/vendor/') to achieve this.

@aviau
Copy link
Author

aviau commented May 29, 2017

Oh! Thanks for the explanation. Looks like this was discussed to death in the issue you linked!

Cheers :)

@aviau aviau closed this as completed May 29, 2017
@sdboyer
Copy link
Member

sdboyer commented May 29, 2017

Though, happily, the meaning of ./... has been changed in tip: golang/go#19090 😄

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

3 participants