Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update github.com/golang-jwt/jwt to github.com/golang-jwt/jwt/v4 #2441

Closed
jxsl13 opened this issue Apr 28, 2023 · 6 comments
Closed

update github.com/golang-jwt/jwt to github.com/golang-jwt/jwt/v4 #2441

jxsl13 opened this issue Apr 28, 2023 · 6 comments

Comments

@jxsl13
Copy link

jxsl13 commented Apr 28, 2023

As the title already states, update the dependency.

I find it pretty weird.
When using github.com/labstack/echo-jwt you get the github.com/golang-jwt/jwt/v4 dependency (https://github.com/labstack/echo-jwt/blob/main/go.mod)
which in turn imports github.com/labstack/echo/middleware importing the github.com/golang-jwt/jwt v3.x.x+incompatible.
You are basically getting both major versions as dependencies which is kind of dirty :).

@aldas
Copy link
Contributor

aldas commented Apr 28, 2023

This is because core has deprecated JWT middleware with that dependency. Go module logic does not use/download that version if you are not using it.

@jxsl13
Copy link
Author

jxsl13 commented Apr 28, 2023

I'm indirectly using both, when I use the new echo-jwt/v4 repo, am I not?

@aldas
Copy link
Contributor

aldas commented Apr 28, 2023

no, you are not using it - unless you invoke code that uses it. It is there because echo-jwt uses types from github.com/labstack/echo/v4/middleware package which contains older deprecated version of middleware which uses v3.x.x....

This has to do with https://go.dev/ref/mod#graph-pruning

At go 1.17 and above, the go command adds an indirect requirement for each module that provides any package imported (even indirectly) by a package or test in the main module or passed as an argument to go get.

@aldas
Copy link
Contributor

aldas commented Apr 28, 2023

I am no expert how go mod exactly works but I know that not all things that are in go.mod files are fetched fully - some of the rows there are fetched to get their metadata ( go.mod,maybe .sum also?) for version resolution and that is all.

@jxsl13
Copy link
Author

jxsl13 commented Apr 28, 2023

thanks for the clarification

@jxsl13 jxsl13 closed this as completed Apr 28, 2023
@jxsl13 jxsl13 reopened this Apr 28, 2023
@jxsl13
Copy link
Author

jxsl13 commented Apr 28, 2023

will close on tuesday. Maybe someone will add a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants