Closed shuLhan closed 5 years ago
Hi! Thanks for the detailed issue.
Unfortunately, this is all kinda in the category of unintended use, because this:
1:09 ~/tmp/sandbox/go/src/bug/godep/vendor/github.com/influxdata/chronograf
master ms 0 % dep ensure -v
Root project is "bug/godep/vendor/github.com/influxdata/chronograf"
dep is not designed to run from within vendor. That root project path that it picked is nonsensical, and it's why it's treating imports of chronograf
as external - that is, included in the solving process. You just can't use dep this way.
i'm also not really clear on what the actual goal is, though it seems like your key problem is being able to build the chronograf binary located in github.com/influxdata/chronograf/cmd/chronograf
. If so, what you'll want to do is add that path to the required
field in Gopkg.toml
, which will guarantee that all of its imports are actually satisfied. That should get rid of this:
go build -o chronograf -ldflags "-s -X main.version=1.5.0.1 -X main.commit=4a97c338" ./cmd/chronograf/main.go
# bug/godep/vendor/github.com/influxdata/chronograf/vendor/github.com/influxdata/chronograf/canned
vendor/github.com/influxdata/chronograf/canned/bin.go:20:11: undefined: AssetNames
vendor/github.com/influxdata/chronograf/canned/bin.go:23:18: undefined: Asset
# bug/godep/vendor/github.com/influxdata/chronograf/vendor/github.com/influxdata/chronograf/dist
vendor/github.com/influxdata/chronograf/dist/dist.go:39:13: undefined: AssetInfo
vendor/github.com/influxdata/chronograf/dist/dist.go:59:18: undefined: Asset
vendor/github.com/influxdata/chronograf/dist/dist.go:74:11: undefined: Asset
vendor/github.com/influxdata/chronograf/dist/dist.go:83:14: undefined: AssetDir
vendor/github.com/influxdata/chronograf/dist/dist.go:84:14: undefined: AssetInfo
You also might want to look at https://github.com/getstream/vg - it can help with some issues like this.
@sdboyer
Sorry for delay, and thank you for responding.
i'm also not really clear on what the actual goal is
The goal is using dep
to manage tools in vendor directory.
I will close the issue since this is old enough and see another solution as you suggested. Thank you again.
Reproduction Steps
Let's say I have package A on GOPATH. Then I cloned chronograf to vendor directory. Directory structure on A will look like these,
Just to make sure, I clean the repo,
Then I run dep ensure,
What version of
dep
are you using (dep version
)?902d09c4 prune: Hide command from help output
What
dep
command did you run?ensure
What did you expect to see?
Package chronograf should not installed on vendor again.
What did you see instead?
Package chronograf installed on vendor.
Why this matter?
chronograf build script (make) will generate some files. When running
go build ./cmd/chronograf
or justmake
will result in error, because Go lookup the chronograf in vendor directory.Sample output of build with make on chronograf directory,
If I remove the chronograf in vendor, then make will run successfully,