Comments (5)
I'm sorry I used the wrong repository name. This worked for me:
$ gofmt -w -r '"github.com/dgrijalva/jwt-go" -> "github.com/golang-jwt/jwt"' .
$ go get github.com/golang-jwt/jwt
from jwt.
@turkenh @jkawamoto We just landed module support, so I'd suggest dropping the replace
if you're having troubles with transitive dependencies and instead importing this package as "github.com/golang-jwt/jwt/v4".
Closing this issue. Feel free to continue commenting and/or create a new issue.
from jwt.
I had a quick look into your PR and I fear that you are stuck in the middle for now. The replace
route only works of you keep the original import path. Replacing the import path will not replace transitive imports.
My best guess would be to switch back to the old dgrijalva import path and use replace. Then once, your transitive dependency also switches to the new import path, remove the replace and switch the import path. Not really a good solution, but it is probably the "safest".
We probably should update the migration guide to reflect that you could run into this kind of problem with other transitive dependencies.
from jwt.
Same here. I only run go mod edit
and go mod tidy
without editing any code but get this error:
$ go mod edit -replace github.com/dgrijalva/jwt-go=github.com/golang-jwt/[email protected]+incompatible
$ go mod tidy
go: finding module for package github.com/golang-jwt/jwt/test
go: finding module for package github.com/golang-jwt/jwt
go: finding module for package github.com/golang-jwt/jwt/request
go: downloading github.com/golang-jwt/jwt v1.0.2
go: found github.com/golang-jwt/jwt in github.com/golang-jwt/jwt v3.2.1+incompatible
go: found github.com/golang-jwt/jwt/request in github.com/golang-jwt/jwt v3.2.1+incompatible
go: found github.com/golang-jwt/jwt/test in github.com/golang-jwt/jwt v3.2.1+incompatible
go: github.com/golang-jwt/[email protected]+incompatible used for two different module paths (github.com/dgrijalva/jwt-go and github.com/golang-jwt/jwt)
I'm not sure why it tries to download v1.0.2 (go: downloading github.com/golang-jwt/jwt v1.0.2
).
I also try to replace import paths in my code with gofmt -w -r '"github.com/dgrijalva/jwt-go" -> "github.com/golang-jwt/jwt-go"' .
then get this error:
$ gofmt -w -r '"github.com/dgrijalva/jwt-go" -> "github.com/golang-jwt/jwt-go"' .
$ go mod download github.com/golang-jwt/jwt-go
go mod download: module github.com/golang-jwt/jwt-go: not a known dependency
go mod download github.com/golang-jwt/[email protected]+incompatible
doesn't return any errors but it looks like it doesn't work:
$ gofmt -w -r '"github.com/dgrijalva/jwt-go" -> "github.com/golang-jwt/jwt-go"' .
$ go mod download github.com/golang-jwt/[email protected]+incompatible
$ go test ./... -v
main.go:25:2: no required module provides package github.com/golang-jwt/jwt-go; to add it:
go get github.com/golang-jwt/jwt-go
I'm wondering if #30 could help. Btw, I'm using Go 1.16.6:
$ go version
go version go1.16.6 darwin/amd64
from jwt.
I had a quick look into your PR and I fear that you are stuck in the middle for now. The
replace
route only works of you keep the original import path. Replacing the import path will not replace transitive imports.My best guess would be to switch back to the old dgrijalva import path and use replace. Then once, your transitive dependency also switches to the new import path, remove the replace and switch the import path. Not really a good solution, but it is probably the "safest".
We probably should update the migration guide to reflect that you could run into this kind of problem with other transitive dependencies.
Ye, I don't know if there is a better solution here when using the replace
directive. I believe this is related to golang/go#26904
I haven't been keeping a close eye on modules, but I think there is some work by @bcmills and the Go team to address such issues in 1.17 and/or 1.18
from jwt.
Related Issues (20)
- Add a specific return type / type constraint to `Keyfunc` and `SignedString`
- Token.New example is for the wrong func HOT 2
- KeyFunc should be able to return a slice HOT 2
- ParseUnverified godoc update HOT 1
- Verifying multiple audiences HOT 2
- Restore .Valid() Functionality Somehow HOT 9
- Is it possible to parse JWT without verifying signature?
- I've mad a small library to help with JWT
- v5.0.0/request/request.go: with WithLeeway support? HOT 2
- SigningString produces a string without a signature HOT 2
- RSA-PSS (RSASSA-PSS) keys are unusable in Go language
- Let KeyFunc take Context as parameter HOT 3
- Customize the unit of timestamp/exp in payload HOT 1
- ECDSA signature is invalid
- I found an error message "token has invalid claims: token is expired"
- Only some registered claims can be optionally required HOT 1
- I have no RegisteredClaims. I have error key is invalid HOT 4
- Question / FR: Subsequent Verification of an Unverified Token
- Consider validating key length HOT 5
- 希望可以校验token格式 I hope that the token format can be verified HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jwt.