Skip to content
This repository has been archived by the owner on Feb 26, 2019. It is now read-only.

godep tries to vendor a test dependency's dependency #494

Open
ahmetb opened this issue Jul 7, 2016 · 2 comments
Open

godep tries to vendor a test dependency's dependency #494

ahmetb opened this issue Jul 7, 2016 · 2 comments

Comments

@ahmetb
Copy link

ahmetb commented Jul 7, 2016

Expected behavior

I have a program which uses these packages:

go get -v ./...

github.com/pkg/errors (download)
github.com/xeipuuv/gojsonschema (download)
github.com/xeipuuv/gojsonreference (download)
github.com/xeipuuv/gojsonpointer (download)
github.com/pkg/errors
github.com/xeipuuv/gojsonpointer
github.com/xeipuuv/gojsonreference
github.com/Azure/custom-script-extension-linux/blobutil
github.com/Azure/custom-script-extension-linux/preprocess
github.com/xeipuuv/gojsonschema
github.com/Azure/custom-script-extension-linux/download
github.com/Azure/custom-script-extension-linux
# github.com/Azure/custom-script-extension-linux
runtime.main: call to external function main.main
runtime.main: main.main: not defined
runtime.main: undefined: main.main

However I use github.com/stretchr/testify/require in my tests. Since it is a test depencency, it does not show up in go get ./....

Problem: Even though testify/require is a library, they have a vendor/ directory (https://github.com/stretchr/testify), IMO it is a bad mistake, but it shouldn't be affecting me in this case.

So, when I run godep save, I don't expect any packages related to this test dependency (or its dependencies) to be even considered.

Actual behavior

Now I run godep save -v which tells me:

godep: Go Version: go1.6
godep: No old Godeps.json found.
godep: Finding dependencies for [.]
godep: Found package: github.com/Azure/custom-script-extension-linux
godep:  Deps: bytes encoding/json errors fmt github.com/pkg/errors github.com/xeipuuv/gojsonpointer github.com/xeipuuv/gojsonreference github.com/xeipuuv/gojsonschema io io/ioutil log math net net/http net/url os path path/filepath reflect regexp runtime strconv strings time unicode/utf8
godep: Computing new Godeps.json file
godep: Package (github.com/stretchr/testify/require) not found

Then I go get github.com/stretchr/testify/require, then run it again:

godep: Go Version: go1.6
godep: No old Godeps.json found.
godep: Finding dependencies for [.]
godep: Found package: github.com/Azure/custom-script-extension-linux
godep:  Deps: bytes encoding/json errors fmt github.com/pkg/errors github.com/xeipuuv/gojsonpointer github.com/xeipuuv/gojsonreference github.com/xeipuuv/gojsonschema io io/ioutil log math net net/http net/url os path path/filepath reflect regexp runtime strconv strings time unicode/utf8
godep: Computing new Godeps.json file
godep: Package (github.com/davecgh/go-spew/spew) not found

Now it is complaining about github.com/davecgh/go-spew/spew which is a dependency of github.com/stretchr/testify/require and vendored under its vendor/

$ tree -d $GOPATH/src/github.com/stretchr/testify
/Users/alp/workspace/gopath-custom-script-extension-linux/src/github.com/stretchr/testify
├── Godeps
├── _codegen
├── assert
├── http
├── mock
├── require
├── suite
└── vendor
    └── github.com
        ├── davecgh
        │   └── go-spew
        │       └── spew
        ├── pmezard
        │   └── go-difflib
        │       └── difflib
        └── stretchr
            └── objx
                └── codegen

But this should not be godep's concern because it is not supposed to do anything for test dependencies, am I right?

Steps to reproduce behavior

Described above.

godep version output

godep v74 (darwin/amd64/go1.6.2)

go version output

go version go1.6.2 darwin/amd64

Contents of Godeps.json file

N/A

@sttts
Copy link

sttts commented Apr 5, 2017

I guess I see the same, but independent from any test:

  • I depend on github.com/libopenstorage/openstorage and godep restore complains that github.com/aws/aws-sdk-go/private/endpoints cannot be found.
  • The only reference is in github.com/libopenstorage/openstorage/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go.
  • In newer versions of github.com/aws/aws-sdk-go the endpoints directory has gone away. Godep though sees the vendor directory and falls over.

@0xdeafcafe
Copy link

I'm getting this issue running godep save ../... where it is outputting godep: Package (github.com/davecgh/go-spew/spew) not found too. I found that the following packages require it - is there a workaround or fix? I'm fairly new to godep.

screen shot 2017-04-13 at 18 59 48

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

No branches or pull requests

4 participants