gbrlsnchs / jwt

Go JWT signing, verifying and validating
MIT License
450 stars 34 forks source link

Fails on go mod download #14

Closed RohitRox closed 5 years ago

RohitRox commented 5 years ago

Adding gbrlsnchs/jwt to a go.mod file and running go mod download is giving this error

go: github.com/gbrlsnchs/jwt@v0.0.0-20180914181710-808efa0714ba: go.mod has post-v0 module path "github.com/gbrlsnchs/jwt/v2" at revision 808efa0714ba
go: error loading module requirements

Go Version: go1.11.4 darwin/amd64

gbrlsnchs commented 5 years ago

You should add github.com/gbrlsnchs/jwt/v2 (with the suffix) to your go.mod file, since it's in v2 already. If you don't, I think you have to specify a v1 version (github.com/gbrlsnchs/jwt@v1.1.0), otherwise go mod tries to fetch the most recent commit, which has a /v2 suffix in its go.mod, thus breaking.

Edit: Actually, when the version is not specified, go mod tries to fetch the commit pointed by the latest tag, in this case, it's v2.0.0, which points to commit 808efa0714ba, in which the module is already declared with a /v2 suffix. That's why I think you need to specify a v1 tag in this case (github.com/gbrlsnchs/jwt@v1.1.0) or use v2 as github.com/gbrlsnchs/jwt/v2, what will pull the latest tag, which coincides with being v2.0.0.

RohitRox commented 5 years ago

I see what you mean. Thank you for explaining.