Echo: Tags are breaking after v3.2.1

Created on 25 Aug 2018  ยท  43Comments  ยท  Source: labstack/echo

Prior to version 3.2.1 inclusive, tags had the format v3.2.1, which was correct and works for Dep / Go modules (vgo). After version 3.2.1 (>=3.2.2), you use a tag format 3.2.2 that is incompatible with Go modules (vgo).

If you try to use Go modules (vgo, go1.11 was released), than you see something like this:

require (
...
github.com/labstack/echo v0.0.0-20180412143600-6d227dfea4d2
...
)

Main changes that was done in 3.2.2, tag name:

  • before vX.Y.Z
  • after X.Y.Z

v was dropped ๐Ÿ˜”

enhancement

Most helpful comment

All 43 comments

How to get the github.com/labstack/echo v0.0.0-20180412143600-6d227dfea4d2

go mod init <project-name>
go mod tidy
go mod verify
go mod vendor

I got github.com/labstack/echo v3.2.1+incompatible

but how to find v0.0.0-20180412143600-6d227dfea4d2

hm.. sorry, mb I don't understand question

If need, I can create simple project to show how it works now

I got github.com/labstack/echo v3.2.1+incompatible
Where can I find the tag v0.0.0-20180412143600-6d227dfea4d2 ?
Any command? go get?

Oh.. understand...

  1. I have some-lib (for example), that require [email protected]
  2. Create new project, thats require echo and some-lib
  3. When run
go mod init <project-name>
go mod vendor

in go.mod we can v0.0.0-20180412143600-6d227dfea4d2

This tells us that the required version of echo could not be found and it was taken from the wizard or from the first tag

Same as before github.com/labstack/echo v3.2.1+incompatible

Try go get github.com/labstack/echo@6d227dfea4d2
and got github.com/labstack/echo v3.2.2-0.20180412143600-6d227dfea4d2+incompatible

for example - https://github.com/im-kulikov/echo-issue-1185

โ†’ go version
go version go1.11 darwin/amd64
โ†’ export GO111MODULE=on
โ†’ go mod init github.com/im-kulikov/echo-issue-1185
go: creating new go.mod: module github.com/im-kulikov/echo-issue-1185
โ†’ go mod tidy
go: finding github.com/im-kulikov/helium v0.5.6
go: finding github.com/chapsuk/mserv v0.0.0-20180706125941-107033951ceb
go: downloading github.com/im-kulikov/helium v0.5.6
go: finding github.com/smartystreets/gunit latest
go: finding github.com/golang/glog latest
go: finding golang.org/x/sync/errgroup latest
go: finding golang.org/x/sync latest
โ†’ cat go.mod
module github.com/im-kulikov/echo-issue-1185

require (
        github.com/BurntSushi/toml v0.3.0 // indirect
        github.com/chapsuk/mserv v0.3.2
        github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
        github.com/im-kulikov/helium v0.5.6
        github.com/labstack/echo v0.0.0-20180412143600-6d227dfea4d2
        github.com/smartystreets/gunit v0.0.0-20180314194857-6f0d6275bdcd // indirect
        go.uber.org/dig v1.4.0
        go.uber.org/zap v1.9.1
        golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect
        gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
)

If I'm not mistaken, helium originally used go/dep and [email protected].
After go mod init <project> (to convert Gopkg.toml in go modules), we get the version specified in the issue header

remove $GOPATH/pkg/mod/cache/download/github.com/labstack/echo
and retry?

Step 2:

โ†’ rm -rf $GOPATH/pkg/mod/cache/download/github.com/labstack/echo
โ†’ cat go.mod
module github.com/im-kulikov/echo-issue-1185

require (
        github.com/im-kulikov/helium v0.5.6
)
โ†’ go mod tidy
go: finding github.com/labstack/echo v0.0.0-20180412143600-6d227dfea4d2
go: downloading github.com/chapsuk/mserv v0.0.0-20180706125941-107033951ceb
go: finding github.com/smartystreets/gunit latest
go: finding github.com/golang/glog latest
go: finding golang.org/x/sync/errgroup latest
go: finding golang.org/x/sync latest
โ†’ cat go.mod
module github.com/im-kulikov/echo-issue-1185

require (
        github.com/BurntSushi/toml v0.3.0 // indirect
        github.com/chapsuk/mserv v0.0.0-20180706125941-107033951ceb
        github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
        github.com/im-kulikov/helium v0.5.6
        github.com/labstack/echo v0.0.0-20180412143600-6d227dfea4d2
        github.com/smartystreets/gunit v0.0.0-20180314194857-6f0d6275bdcd // indirect
        go.uber.org/dig v1.3.0
        go.uber.org/zap v1.9.0
        golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect
        gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
)

As you can see

github.com/labstack/echo v0.0.0-20180412143600-6d227dfea4d2

remove cached echo version and go.mod echo version

and go.mod echo version

โ†’ cat go.mod
module github.com/im-kulikov/echo-issue-1185

require (
        github.com/im-kulikov/helium v0.5.6
)

I found the reason

https://golang.org/cmd/go/#hdr-Module_compatibility_and_semantic_versioning

Code written before the semantic import versioning convention was introduced may use major versions v2 and later to describe the same set of unversioned import paths as used in v0 and v1. To accommodate such code, if a source code repository has a v2.0.0 or later tag for a file tree with no go.mod, the version is considered to be part of the v1 module's available versions and is given an +incompatible suffix when converted to a module version, as in v2.0.0+incompatible. The +incompatible tag is also applied to pseudo-versions derived from such versions, as in v2.0.1-0.yyyymmddhhmmss-abcdefabcdef+incompatible.

@im-kulikov I see
Thanks

This is weird. Don't you think a drastic change in tag naming could be a problem?

go mod can't import version above 3.2.1
I think that's the bigger problem.
That is, if I do not want to use 3.2.1, and want to move to 3.3.5 - I will not (explicitly)

Yes, I do.

Just want to know why I got v3.2.2-0.20180412143600-6d227dfea4d2+incompatible?

Oh.. don't know ๐Ÿ˜”

When I migrate from go/dep to go mod, I received v0.0.0-20180412143600-6d227dfea4d2

Step 3

rm -rf $GOPATH/pkg/mod/cache
โ†’ cat go.mod
module github.com/im-kulikov/echo-issue-1185

require (
        github.com/im-kulikov/helium v0.5.6
)
โ†’ rm go.sum
โ†’ go mod tidy
go: finding github.com/im-kulikov/helium v0.5.6
go: finding github.com/davecgh/go-spew v1.1.0
go: finding github.com/prometheus/common v0.0.0-20180518154759-7600349dcfe1
go: finding github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: finding github.com/smartystreets/goconvey v0.0.0-20170602164621-9e8dc3f972df
go: finding github.com/go-playground/universal-translator v0.16.0
go: finding github.com/chapsuk/wait v0.0.0-20180530144602-2dc40db0485b
go: finding github.com/nats-io/go-nats v1.5.0
go: finding golang.org/x/sys v0.0.0-20180715085529-ac767d655b30
go: finding go.uber.org/dig v1.3.0
go: finding go.uber.org/multierr v1.1.0
go: finding github.com/urfave/cli v1.20.0
go: finding github.com/spf13/cast v1.2.0
go: finding github.com/gopherjs/gopherjs v0.0.0-20180628210949-0892b62f0d9f
go: finding github.com/magiconair/properties v1.8.0
go: finding github.com/stretchr/testify v1.2.2
go: finding google.golang.org/genproto v0.0.0-20180722052100-02b4e9547331
go: finding github.com/labstack/gommon v0.0.0-20180613044413-d6898124de91
go: finding github.com/pelletier/go-toml v1.2.0
go: finding github.com/prometheus/procfs v0.0.0-20180705121852-ae68e2d4c00f
go: finding github.com/bsm/redis-lock v8.0.0+incompatible
go: finding github.com/fsnotify/fsnotify v1.4.7
go: finding github.com/matttproud/golang_protobuf_extensions v1.0.1
go: finding golang.org/x/net v0.0.0-20180719180050-a680a1efc54d
go: finding github.com/chapsuk/mserv v0.0.0-20180706125941-107033951ceb
go: finding github.com/jtolds/gls v4.2.1+incompatible
go: finding github.com/smartystreets/assertions v0.0.0-20180301161246-7678a5452ebe
go: finding golang.org/x/text v0.3.0
go: finding github.com/jinzhu/inflection v0.0.0-20180308033659-04140366298a
go: finding github.com/golang/protobuf v1.1.0
go: finding github.com/chapsuk/worker v0.4.0
go: finding github.com/prometheus/client_golang v0.8.0
go: finding gopkg.in/yaml.v2 v2.2.1
go: finding go.uber.org/zap v1.9.0
go: finding github.com/mattn/go-colorable v0.0.9
go: finding github.com/valyala/bytebufferpool v0.0.0-20160817181652-e746df99fe4a
go: finding github.com/labstack/echo v0.0.0-20180412143600-6d227dfea4d2
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
go: finding github.com/go-pg/pg v6.14.3+incompatible
go: finding github.com/pkg/errors v0.8.0
go: finding github.com/bouk/monkey v0.0.0-20180215074647-5df1f207ff77
go: finding github.com/robfig/cron v0.0.0-20180505203441-b41be1df6967
go: finding github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4
go: finding github.com/mitchellh/mapstructure v0.0.0-20180715050151-f15292f7a699
go: finding github.com/spf13/viper v1.0.2
go: finding github.com/go-playground/locales v0.12.1
go: finding github.com/spf13/afero v1.1.1
go: finding github.com/mattn/go-isatty v0.0.3
go: finding github.com/go-redis/redis v6.13.0+incompatible
go: finding github.com/spf13/pflag v1.0.1
go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
go: finding gopkg.in/go-playground/validator.v9 v9.20.2
go: finding google.golang.org/grpc v1.13.0
go: finding github.com/hashicorp/hcl v0.0.0-20180404174102-ef8a98b0bbce
go: finding github.com/nats-io/nuid v1.0.0
go: finding github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec
go: finding go.uber.org/atomic v1.3.2
go: finding golang.org/x/crypto v0.0.0-20180718160520-a2144134853f
go: finding github.com/smartystreets/gunit latest
go: finding github.com/golang/glog latest
go: finding github.com/BurntSushi/toml v0.3.0
go: finding gopkg.in/go-playground/assert.v1 v1.2.1
go: finding golang.org/x/sync/errgroup latest
go: finding golang.org/x/sync latest
โ†’ cat go.mod
module github.com/im-kulikov/echo-issue-1185

require (
        github.com/BurntSushi/toml v0.3.0 // indirect
        github.com/chapsuk/mserv v0.0.0-20180706125941-107033951ceb
        github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
        github.com/im-kulikov/helium v0.5.6
        github.com/labstack/echo v0.0.0-20180412143600-6d227dfea4d2
        github.com/smartystreets/gunit v0.0.0-20180314194857-6f0d6275bdcd // indirect
        go.uber.org/dig v1.3.0
        go.uber.org/zap v1.9.0
        golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect
        gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
)

As you can see

github.com/labstack/echo v0.0.0-20180412143600-6d227dfea4d2

Options (using modules):
default(v3.2.1) - go get github.com/labstack/echo
master - go get github.com/labstack/echo@master
v3.3.5 - go get github.com/labstack/echo@6d227dfea4d2

@vishr any updates?

@im-kulikov This is inline with https://semver.org (https://github.com/semver/semver/blob/master/semver.md#user-content-is-v123-a-semantic-version). I am open for discussion.

Before 3.2.1 tag was formatted โ€œvX.Y.Zโ€, and after โ€œX.Y.Zโ€..
This is not work with go modules.
Maybe we can revert to old tag naming?

In many go packages, tag naming is in form โ€œvX.Y.Zโ€

This is inline with

Example: git tag v1.2.3 -m "Release version 1.2.3", in which case "v1.2.3" is a tag name and the semantic version is "1.2.3".

@im-kulikov We can address this in the next release.

Same problem! Latest tags dropped the letter v. That causes problems with modules. If we try command go get -v -u github.com/labstack/[email protected] (mind the version 3.3.5 which should be v3.3.5). Then the latest version we get is: v3.2.2-0.20180412143600-6d227dfea4d2+incompatible.

If it sounds fine, maybe two tags should be added to allow people to downgrade (just in case). For example v3.3.5mod (on current released 3.3.5 commit) and the next release could be v3.3.6.

@alexaandru Can you help me with a new release? We should change the tag back to prefixed with v.

And if you see fit, go.mod should be added too, which helps the adoption with the new module system.

Is it fix now?

Still broken..

I think the only solution for this problem is to add v... tags for _all_ the existing ones.
This shouldn't have any negative side-effects, the old ones can be kept if necessary.

@vishr Thanks! Did not have time to say about gommon, as you already fixed it! ๐ŸŽ‰๐Ÿ‘๐Ÿป

I did probably needs an update.

Sent from my iPhone

On Sep 11, 2018, at 2:36 AM, Evgeniy Kulikov notifications@github.com wrote:

@vishr can we do the same with gommon?

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

Explain?

@im-kulikov Never mind, I misread it.

go get github.com/labstack/echo@master
You will be able to see

v0.0.0-20180xxxxxxxxx-xxxxx

v3.2.1
image

3.2.2
image

That's the reason.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dre1080 picture dre1080  ยท  4Comments

absinsekt picture absinsekt  ยท  4Comments

toorop picture toorop  ยท  4Comments

spielstein picture spielstein  ยท  3Comments

leoycx picture leoycx  ยท  4Comments