Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/vgo: `vgo vendor` fails with github.com/stretchr/testify #25871

Closed
mwf opened this issue Jun 13, 2018 · 4 comments

Comments

@mwf
Copy link

commented Jun 13, 2018

What version of Go are you using (go version)?

go version go1.10.1 darwin/amd64 vgo:2018-02-20.1

Latest vgo:

commit 7fbc8df48a749126c4596fd0a5e78f3941c7913b (HEAD -> master, origin/master, origin/HEAD)
Author: Russ Cox <rsc@golang.org>
Date:   Fri Jun 8 13:18:03 2018 -0400

    x/vgo: incorporate current Go 1.11 development tree

What did you do?

Please refer to https://github.com/mwf/goplay/tree/master/vgo/testify

vgo list -m
MODULE                             VERSION
github.com/mwf/goplay/vgo/testify  -
github.com/davecgh/go-spew         v1.1.0
github.com/pmezard/go-difflib      v1.0.0
github.com/stretchr/objx           v0.0.0-20180106011353-facf9a85c22f
github.com/stretchr/testify        v1.2.2

vgo vendor
vgo: import "github.com/davecgh/go-spew/spew/testdata" [/Users/ikorolev/dev/go/src/v/github.com/davecgh/go-spew@v1.1.0/spew/testdata]: no Go source files

This happens with all projects using github.com/stretchr/testify when you try to use vgo vendor.

If you check https://github.com/davecgh/go-spew/blob/master/spew/testdata/dumpcgo.go you can see that it uses build tags // +build cgo,testcgo

And this file is used in https://github.com/davecgh/go-spew/blob/master/spew/dumpcgo_test.go which is also built only when using the same build tags.

What did you expect to see?

I expect vgo vendor to populate the vendor folder.
It seems it doesn't respect build tags on some stage.

What did you see instead?

vgo vendor fails to populate vendor folder with an error:

vgo: import "github.com/davecgh/go-spew/spew/testdata" [/Users/ikorolev/dev/go/src/v/github.com/davecgh/go-spew@v1.1.0/spew/testdata]: no Go source files
@oiooj

This comment has been minimized.

Copy link
Member

commented Jun 13, 2018

@rsc @bcmills Should we skip this error for package import?

@bcmills

This comment has been minimized.

Copy link
Member

commented Jun 13, 2018

I expect vgo vendor to populate the vendor folder.
It seems it doesn't respect build tags on some stage.

Ignoring build tags is the intended behavior as of https://golang.org/cl/117258, but I don't understand why vgo vendor is trying to actually import the vendored packages with build constraints applied. That seems like a bug.

@mwf

This comment has been minimized.

Copy link
Author

commented Jun 14, 2018

Ignoring build tags is the intended behavior as of https://golang.org/cl/117258, but I don't understand why vgo vendor is trying to actually import the vendored packages with build constraints applied. That seems like a bug.

Thanks! The problem is introduced with this change indeed.
I will use vgo from the parent commit for now - 1df2402.

Looking forward to a bugfix :)

@gopherbot

This comment has been minimized.

Copy link

commented Jun 14, 2018

Change https://golang.org/cl/118956 mentions this issue: cmd/go/internal/vgo: fix vendor for packages limited to a single tag

@golang golang locked and limited conversation to collaborators Jun 14, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants
You can’t perform that action at this time.