cespare / xxhash

A Go implementation of the 64-bit xxHash algorithm (XXH64)
MIT License
1.79k stars 123 forks source link

Fix minimal go version (>=1.11) #32

Closed jooola closed 4 years ago

jooola commented 4 years ago

When downloading your library with go <1.13, it fails because of the requirement set in the go.mod file.

cespare commented 4 years ago

The go directive doesn't mean that the module can't be built with earlier versions of go. It controls what language features are available within the module. I don't think xxhash is using any post-Go.11 features, and indeed, it works fine with Go 1.11.4 for me:

$ mkdir /tmp/test111 && cd /tmp/test111 && echo module github.com/blah > go.mod && GO111MODULE=on go1.11.4 test github.com/cespare/xxhash/v2
ok      github.com/cespare/xxhash/v2    0.004s

What command were you running? What version of Go are you using?

jooola commented 4 years ago

Ooh mybad, I though so. So I'm a bit confused. I found this ticket talking about this : https://github.com/golang/go/issues/30446

My problem comes from the following build log: https://travis-ci.org/jooola/restic-server/jobs/605681466

jooola commented 4 years ago

I guess I need to force go version >= 1.11.4 in travis.

cespare commented 4 years ago

Ah, I see. This is essentially a bug in Go 1.11, then -- if you're using Go 1.11 for something, you should at least upgrade to Go 1.11.4, which has the bug fix.

Thinking about this more, though, I think it's reasonable to set the language version directive to 1.11 for now, since xxhash isn't using any particularly new features. Then we wouldn't be able to accidentally start using new language features without explicitly bumping the version, which seems good.