jwt-go icon indicating copy to clipboard operation
jwt-go copied to clipboard

go get showing this library as +incompatible in go.mod

Open bjm88 opened this issue 6 years ago • 11 comments

When upgrading from go 1.10 to 1.11 and starting to use go.mod I noticed this was an issue. I was indirectly using this by using github.com/appleboy/gin-jwt v2.3.1 but even trying to use it directly I get this +incompatible marking.. not sure what it means or why actually...

ithub.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect

??

bjm88 avatar Sep 21 '18 16:09 bjm88

Go mod requires some special flags. When I last looked at this, dep was the recommended thing and go mod was just a proposal. Since it's included in go 1.11, it would appear it's time to add support. I'll look into this over the weekend.

dgrijalva avatar Sep 21 '18 17:09 dgrijalva

Great thank you. There is a good video on pitfalls of dep and why they went another route. Finally having a real module Management system in go tooling is huge so glad it's being standardized

bjm88 avatar Sep 21 '18 19:09 bjm88

I also faced same issue after going through go mod docs I found a way to solve this. Assuming if we are using go mod then go version is 1.11

  1. cd $GOPATH/github.com/gfrijalva/jwt-go
  2. go mod init
  3. go build
  4. go get github.com/marwan-at-work/mod/cmd/mod
  5. mod upgrade (this will take module version to v2)
  6. mod upgrade (v3).
  7. Commit the changes and push it will work after this @dgrijalva I tried to create a pr but I was not able to push(do not have remote push rights) refrences: https://github.com/golang/go/wiki/Modules#semantic-import-versioning https://github.com/golang/go/wiki/Modules#releasing-modules-v2-or-higher https://github.com/marwan-at-work/mod

vijay1811 avatar Oct 29 '18 02:10 vijay1811

@dgrijalva any update on this?

mdsolsawangwan avatar Dec 11 '18 01:12 mdsolsawangwan

Any fixes for this ?

majuansari avatar Jan 13 '19 04:01 majuansari

Started working this when I imported "github.com/vladimiroff/jwt-go/v3" . Hope this helps some one

majuansari avatar Jan 13 '19 05:01 majuansari

Are there any plans to fix this? If so, any idea when the fix will be available?

brentgriffin avatar Mar 02 '19 14:03 brentgriffin

Support for go modules is coming in v4. I don't think it's possible to add support as a non-breaking change.

dgrijalva avatar May 28 '19 21:05 dgrijalva

Thanks for the response about it coming in v4 - what is the projected timeframe of v4?

brentgriffin avatar Jun 24 '19 04:06 brentgriffin

I faced some issues with go modules and jwt-go package, and taking a look in the format of other require modules inside my go.mod file I realized you can "import" them in a certain format, like so:

github.com/dgrijalva/jwt-go v0.0.0-20180308151308-06ea1031745c // inderect

20180308151308 -> this part is the date of the last commit made on master branch 06ea1031745c -> it's the first 12 letters of last commit hash on master branch.

It's working for me, but I'm waiting for v4 to get go mod support, hope it helps some else.

gustavocd avatar Jul 07 '19 03:07 gustavocd

github.com/dgrijalva/jwt-go v0.0.0-20180308151308-06ea1031745c // inderect

did you just use go get on that?

David-Tenni avatar Dec 23 '19 04:12 David-Tenni