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)

Most upvoted comments

@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:

Module support is considered experimental, and there are still a few rough edges to smooth out, so please make liberal use of the issue tracker.

@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 version print?

If you’re using Go 1.10.4 or later, are you in a sub-directory of $GOPATH? If you are, please set export GO111MODULE=on and try go 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=on and GO111MODULE=off.

Changes to the import path are reverted, so keep using github.com/olivere/elastic for v6. Go modules will probably have to wait for a while until tooling is ready, e.g. dep support 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 with export GO111MODULE=on.

In the long run, Go is moving away from $GOPATH. I’m not happy with that tbh.

@olivere export GO111MODULE=on did the trick for me. Go version is go1.11 linux/amd64. Thank you!

Using “github.com/olivere/elastic/v6” as import path and running go get still results for me in

package github.com/olivere/elastic/v6: cannot find package “github.com/olivere/elastic/v6” in any of: /usr/local/go/src/github.com/olivere/elastic/v6 (from $GOROOT) /home/moritz/Go/src/github.com/olivere/elastic/v6 (from $GOPATH)

Did I miss something? Sorry, Im quite new to Go