Closed InFog closed 3 years ago
Update: I also tried it using Go 1.14. Still not working using the v4 example.
Using the outdated v3 version of echo is not an option anymore ;-)
Could you please open an issue instead and describe the steps you took there. This might have been caused by a recent merge to update the docs to v4.
Hi, @lammel.
I checked the README and it says only a couple specific versions of Go will understand using /vN suffix.
When I opened the PR I was using Go 1.13 and maybe that was the cause of the issue, but now I'm on 1.14.7 and it is still not working. I ran go get github.com/labstack/echo
and it properly installed Echo v4 (Commit 429a8db01d8ef92a568a98ab2a0c4275c3dfbe7e), but for some reason using /v4 does not work.
The steps:
$ mkdir myproject
$ cd myproject
$ go get github.com/labstack/echo/v4
package github.com/labstack/echo/v4: cannot find package "github.com/labstack/echo/v4" in any of:
/usr/lib/go-1.14/src/github.com/labstack/echo/v4 (from $GOROOT)
/home/junior/go/src/github.com/labstack/echo/v4 (from $GOPATH)
$ go get github.com/labstack/echo
$ echo $?
0
Just to be clear, if I install if with no /v4 prefix this is what I get when running the server:
____ __
/ __/___/ / ___
/ _// __/ _ \/ _ \
/___/\__/_//_/\___/ v4.1.17
High performance, minimalist Go web framework
So, v4 is used anyway.
There must be something wrong with your GOPATH or lokal go.mod file. It just works as expected for me (removed pkgs from $GOPATH first)
rl@slimboy# go get -v github.com/labstack/echo/v4 go: downloading github.com/labstack/echo/v4 v4.1.17
go: downloading golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb
go: downloading golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c
go: downloading github.com/labstack/gommon v0.3.0
go: downloading github.com/valyala/fasttemplate v1.2.1
go: downloading github.com/mattn/go-colorable v0.1.8
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading golang.org/x/sys v0.0.0-20201204225414-ed752295db88
go: downloading github.com/valyala/bytebufferpool v1.0.0
go: downloading golang.org/x/text v0.3.4
This is rather strange.
Please cleanup all github.com/labstack packages from your GOPATH oder vendor dir and retry with go get -v github.com/labstack/echo/v4
.
To be sure what is currently installed use find $GOPATH/pkg/mod/github.com/labstack
and check for local go.mod file.
Thank you for the help, @lammel, I really appreciate it.
So, still no success here.
$ go get -v github.com/labstack/echo/v4
github.com/labstack/echo (download)
package github.com/labstack/echo/v4: cannot find package "github.com/labstack/echo/v4" in any of:
/usr/lib/go-1.14/src/github.com/labstack/echo/v4 (from $GOROOT)
/home/junior/go/src/github.com/labstack/echo/v4 (from $GOPATH)
$ go version
go version go1.14.7 linux/amd64
The go.mod
installed file reads:
module github.com/labstack/echo/v4
go 1.15
require (
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/labstack/gommon v0.3.0
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/stretchr/testify v1.4.0
github.com/valyala/fasttemplate v1.2.1
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
golang.org/x/net v0.0.0-20200822124328-c89045814202
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6 // indirect
golang.org/x/text v0.3.3 // indirect
)
Strange... because the go version I have here is 1.14.
Somehow I have the correct version, but installing it with /v4 does not work.
I tried to reproduce the issue you are facing but it works out for me. echo v4 is only tagged for echo/v4 so I'm not sure, why it even works for you as your output states the version cannot be downloaded....
Which plattform are you using (Win/Linux/Mac)?
I even retested with an empty GOPATH:
rl@slimboy# export GOPATH=/tmp/go
rl@slimboy# go get -v github.com/labstack/echo
go: downloading github.com/labstack/echo v3.3.10+incompatible
go: downloading github.com/labstack/gommon v0.3.0
go: downloading golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a
go: downloading github.com/mattn/go-isatty v0.0.12
go: downloading github.com/mattn/go-colorable v0.1.7
go: downloading github.com/valyala/fasttemplate v1.2.1
go: downloading golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6
go: downloading github.com/valyala/bytebufferpool v1.0.0
go: downloading golang.org/x/net v0.0.0-20200822124328-c89045814202
go: downloading golang.org/x/text v0.3.3
golang.org/x/sys/internal/unsafeheader
github.com/valyala/bytebufferpool
golang.org/x/text/transform
golang.org/x/sys/unix
golang.org/x/text/unicode/bidi
golang.org/x/crypto/acme
github.com/valyala/fasttemplate
golang.org/x/text/unicode/norm
golang.org/x/text/secure/bidirule
golang.org/x/net/idna
github.com/mattn/go-isatty
golang.org/x/crypto/acme/autocert
github.com/mattn/go-colorable
github.com/labstack/gommon/color
github.com/labstack/gommon/log
github.com/labstack/echo
After installation only the expected latest echo v3 version is installed to the Go path:
rl@slimboy# find /tmp/go -name '*echo*' -type d
/tmp/go/pkg/mod/github.com/labstack/echo@v3.3.10+incompatible
/tmp/go/pkg/mod/cache/download/github.com/labstack/echo
Which go version are you using, @lammel ?
Good catch. It is indeed not working with go v1.14.
rl@einstein# go1.14.1 get github.com/labstack/echo/v4 package github.com/labstack/echo/v4: cannot find package "github.com/labstack/echo/v4" in any of:
/home/rl/sdk/go1.14.1/src/github.com/labstack/echo/v4 (from $GOROOT)
/tmp/go/src/github.com/labstack/echo/v4 (from $GOPATH)
For v1.13 and v1.14 the GO111MODULE=on is needed:
rl@einstein /t GO111MODULE=on go1.14.1 get github.com/labstack/echo/v4 go: downloading github.com/labstack/echo v1.4.4
go: downloading github.com/labstack/echo/v4 v4.1.17
go: downloading github.com/labstack/echo v3.3.10+incompatible
go: github.com/labstack/echo/v4 upgrade => v4.1.17
...
I've pushed a fix (on master accidently) now, so I think we can close this PR.
Let me know if it works for you too with GO111MODULE=on
. A nice article with an explaination is here
Yep, with GO111MODULE=on
it works.
Also, thanks for the link, it helped me understanding the issue with Go dependencies.
Me too ;-)
This is the reason why I removed it from the guide.
This is the message I was getting: