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

Go module doesn't pick the latest version #903

Closed
xitonix opened this issue Sep 11, 2018 · 4 comments
Closed

Go module doesn't pick the latest version #903

xitonix opened this issue Sep 11, 2018 · 4 comments
Assignees
Labels
Milestone

Comments

@xitonix
Copy link

xitonix commented Sep 11, 2018

Hi Oliver,

I am not actually sure if this is a bug in go mod or there is something specific to this repo's setup (or maybe this is the expected behaviour), but I thought maybe I consult it with you before I raise it with the Go team, if that's an issue. I'd appreciate it if you could shed some light on this please.

Which version of Elastic are you using?

[X ] elastic.v6 (for Elasticsearch 6.x)
[ ] elastic.v5 (for Elasticsearch 5.x)
[ ] elastic.v3 (for Elasticsearch 2.x)
[ ] elastic.v2 (for Elasticsearch 1.x)

Please describe the expected behavior

I expect go module to go with the latest released version, which is v6.2.5 at the time

Please describe the actual behaviour

For some reason go module picks v6.1.25 instead and marks it as incompatible.

Here is the entry in my go.mod file:
github.com/olivere/elastic v6.1.25+incompatible

Also, if I try to pin the dependency to the latest version by running go get github.com/olivere/elastic@v6.2.5 this is how my go.mod gets updated:

github.com/olivere/elastic v0.0.0-20180831175714-e6cae211ee80

Any steps to reproduce the behavior?

  • Create a brand new repo outside of $GOPATH with the reference to github.com/olivere/elastic
  • Run go mod init your_example_package
  • Run go build
@olivere
Copy link
Owner

olivere commented Sep 11, 2018

I was an early adopter of Go modules for v6, but it has caused some pain (see #877). So I rolled it back and decided that v7 will be the first release to support Go modules.

Regarding the version selection mechanism: Thanks for reporting. I'm not exactly sure why Go 1.11 does this, really. I'd be more than happy if you could dig into it because I'm quite busy with my day job these days. Forcing the version number works though, as you already found out.

@xitonix
Copy link
Author

xitonix commented Sep 11, 2018

Thanks mate. I will see what I can find.

@xitonix
Copy link
Author

xitonix commented Sep 12, 2018

Hi Oliver. I did a bit of investigation and I believe the issue is cause by 66b430c . Basically, you removed the SEMver from the import path but you probably forgot to remove the go.mod file. That's why go mod thinks that it's a valid module which is not true. v6.1.25 is basically the last release without the go.mod file and that's why go build stops there. Check out this code in the vgo repo please, which is basically the bit that filters out any versions above v6.1.25.

Given that go mod is backward compatible, I believe removing go.mod and releasing a new tag will solve this problem, until you properly support go modules as planned for v7.

I forked your repo and tested it out and it worked. Feel free to have a look plese: https://github.com/xitonix/elastic/releases

Thanks @johnnyluo for helping me to find the issue :)

@olivere
Copy link
Owner

olivere commented Sep 12, 2018

Yeah, that makes sense. Thank you very much @xitonix and @johnnyluo for tracking this down! I will remove the go.mod in v6.2.6 (due on the weekend) and we'll see what happens next :-)

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

No branches or pull requests

2 participants