Dep: packages are missing

Created on 29 May 2017  路  4Comments  路  Source: golang/dep

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

Most helpful comment

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

All 4 comments

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

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

./... in go also mean vendor folder see https://github.com/golang/go/issues/11659

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

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

Cheers :)

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

godcong picture godcong  路  27Comments

fabulous-gopher picture fabulous-gopher  路  27Comments

davecheney picture davecheney  路  32Comments

pbennett picture pbennett  路  30Comments

sdboyer picture sdboyer  路  40Comments