-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
keyfunc.JWKs: Keys field undefined in v0.8.0 #16
Comments
In The reason for this is because it's unsafe to access this field when there's a background refresh goroutine. Accessing the previously exported
When I noticed this was possible, I unexported the variable to prevent a package user from doing this. I failed to find a use case for a package user to read or write to the I'm assuming this issue was raised because there is a use case to read or write to the If the use case involves a write and the new implementation involving "given keys" does not satisfy the use case, would you mind sharing it? It would help me better implement a solution to access the If the use case is a read-only call to Some people are familiar with the map read/write race condition. For those who are not, take a look at this example. It should cause a Go panic. package main
import (
"sync"
)
func main() {
m := make(map[string]int)
wait := sync.WaitGroup{}
iterations := 1000
const key = ""
wait.Add(1)
go func() {
for i := 0; i < iterations; i++ {
m[key] = i
}
wait.Done()
}()
for i := 0; i < iterations; i++ {
println(m[key])
}
wait.Wait()
} |
Thanks for the thorough explanation. You're right, at some point the above code fails with a It turns out the |
As a suggestion, I'd turn off "Renovate with automerge" for packages in pre-release, like this one. Breaking changes can occur at any minor version bump until there is a full release. Here's a reference for Go packages in the first-unstable release like this one: It's certainly useful to check that keys exist in the As a note, I'm currently in the process of drafting a PR for the upstream |
Sounds great! We don't use automerge for mission critical apps, and it's linked with the CI/CD Pipelines. So if build or tests fail, nothing gets merged or even deployed to staging, and the developer gets notified. That's a good compromise for most of my standard use cases. And yes, I'm using |
@tillkuhn Please see the recent addition in |
It works, thanks for the quick fix! |
After upgrading from v0.7.0 to v0.8.0 I get the following compile time error:
It seems the previous JWKs struct exported a field
Keys
of typemap[string]*JSONKey
, which is now gone. What is the alternative to access the keys for a Set?Thanks,
Till
The text was updated successfully, but these errors were encountered: