klauspost/pgzip

Publish version tags that are compatible with Go Modules

shoenig opened this issue · 2 comments

Go 1.12 and beyond require tags to be published in the form vN.N.N (all three numbers are required). Right now there exists v1.1 and v½.2.0 which the compiler doesn't behave as one might expect.

For example (using Go1.11 + GO111MODULE=on),

v1.1 does not work:

[p1 foobar] $ cat go.mod
module foobar

require (
	github.com/klauspost/pgzip v1.1
)
[p1 foobar] $ go build
go: errors parsing go.mod:
/tmp/foobar/go.mod:4: invalid module version "v1.1": no matching versions for query "v1.1"

whereas v1.0.1 does work:

[p1 foobar] $ cat go.mod
module foobar

require (
	github.com/klauspost/pgzip v1.0.1
)
[p1 foobar] $ go build
go: finding github.com/klauspost/compress/flate latest
go: finding github.com/klauspost/crc32 latest
[p1 foobar] $

tag v½.2.0 seems to trigger the fallback timestamp+hash pseudo version behavior:

[p1 foobar] $ cat go.mod
module foobar

require (
	github.com/klauspost/pgzip v½.2.0
)
[p1 foobar] $ go build
go: finding github.com/klauspost/pgzip v½.2.0
go: finding github.com/klauspost/compress/flate latest
go: finding github.com/klauspost/crc32 latest
[p1 foobar] $ cat go.mod
module foobar

require (
	github.com/klauspost/compress v1.4.1 // indirect
	github.com/klauspost/cpuid v1.2.0 // indirect
	github.com/klauspost/crc32 v0.0.0-20170628072449-bab58d77464a // indirect
	github.com/klauspost/pgzip v1.0.2-0.20180717084224-c4ad2ed77aec
)

Attempting to use v1.1.0 (as one might expect to be synonymous with v1.1) also doesn't work:

[p1 foobar] $ cat go.mod
module foobar

require (
	github.com/klauspost/pgzip v1.1.0
)
[p1 foobar] $ go build
go: finding github.com/klauspost/pgzip v1.1.0
go: github.com/klauspost/pgzip@v1.1.0: unknown revision v1.1.0
go: error loading module requirements

Lol - was rushing through my library, seems I made a typo 🤣

I added a tag, but also removed the obsolete crc32 dependency.

Thanks for reporting!