elastic: Default branch, release-branch.v6 has some compile/import problems
I am about to switch to go modules but it appears the branch release-branch.v6 has some import problems when you just try to use it using old-fashioned GOPATH…
When you compile you get:
/go/src/github.com/olivere/elastic/client.go:24:2: cannot find package "github.com/olivere/elastic/v6/config" in any of:
/usr/local/go/src/github.com/olivere/elastic/v6/config (from $GOROOT)
/go/src/github.com/olivere/elastic/v6/config (from $GOPATH)
/go/src/github.com/olivere/elastic/bulk.go:14:2: cannot find package "github.com/olivere/elastic/v6/uritemplates" in any of:
/usr/local/go/src/github.com/olivere/elastic/v6/uritemplates (from $GOROOT)
/go/src/github.com/olivere/elastic/v6/uritemplates (from $GOPATH)
I realize you recommend to use a dependency manager however prior to your latest update it still worked okay.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 25 (19 by maintainers)
@olivere This is not an acceptable solution to our problem. The changes to the default branch paths are not backwards compatible for consumers who’ve not yet enabled the experimental module support.
EDIT: From the release page:
@snowzach If I can help, let me know. From my experience: If you can use a recent version of Go, it will just work: You only need to change the import path.
@MoritzGoeckel What version of Go are you on? What does
go versionprint?If you’re using Go 1.10.4 or later, are you in a sub-directory of
$GOPATH? If you are, please setexport GO111MODULE=onand trygo get ...again. Please also read this blog post.I just released 6.2.2 which tests on Go 1.10 and 1.11 both with
GO111MODULE=onandGO111MODULE=off.Changes to the import path are reverted, so keep using
github.com/olivere/elasticforv6. Go modules will probably have to wait for a while until tooling is ready, e.g.depsupport for module-awareness.However, as a reminder: DO NOT use the default branch. It will break from time to time. Use tagged releases!
@MoritzGoeckel Go 1.11 has Go modules disabled by default in
$GOPATH/.... It is enabled by default outside of$GOPATH/.... So if you want to use Go modules inside$GOPATH/..., you need to manually turn it on withexport GO111MODULE=on.In the long run, Go is moving away from
$GOPATH. I’m not happy with that tbh.@olivere
export GO111MODULE=ondid the trick for me. Go version isgo1.11 linux/amd64. Thank you!Using “github.com/olivere/elastic/v6” as import path and running
go getstill results for me inDid I miss something? Sorry, Im quite new to Go