dgraph-io / ristretto

A high performance memory-bound Go cache
https://dgraph.io/blog/post/introducing-ristretto-high-perf-go-cache/
Apache License 2.0
5.54k stars 366 forks source link

[BUG]: cannot use generic type ristretto.Cache[K z.Key, V any] without instantiation #394

Open poornachandratejasvi opened 1 day ago

poornachandratejasvi commented 1 day ago

What version of Ristretto are you using?

github.com/ory/viper

/root/go/pkg/mod/github.com/ory/viper@v1.7.5/viper.go:224:16: cannot use generic type ristretto.Cache[K z.Key, V any] without instantiation getting below error post ristretto go package is updated to v1.0.0 from github.com/dgraph-io/ristretto v0.1.1

/root/go/pkg/mod/github.com/ory/viper@v1.7.5/viper.go:253:17: implicit function instantiation requires go1.18 or later (-lang was set to go1.12; check go.mod) /root/go/pkg/mod/github.com/ory/viper@v1.7.5/viper.go:253:37: cannot use generic type ristretto.Config[K z.Key, V any] without instantiation /root/go/pkg/mod/github.com/ory/viper@v1.7.5/viper.go:307:15: cannot use generic type ristretto.Cache[K z.Key, V any] without instantiation /root/go/pkg/mod/github.com/ory/viper@v1.7.5/viper.go:307:36: cannot use generic type ristretto.Config[K z.Key, V any] without instantiation

What version of Go are you using?

1.22.6

Have you tried reproducing the issue with the latest release?

None

What is the hardware spec (RAM, CPU, OS)?

docker arm64

What steps will reproduce the bug?

any package who is using this package will get the issue

github.com/ory/go-acc

Expected behavior and actual result.

No response

Additional information

No response

jney commented 1 day ago

Same issue using badger and upgrading:

- github.com/dgraph-io/ristretto v0.1.1 // indirect
+ github.com/dgraph-io/ristretto v1.0.0 // indirect
OK93-01-18 commented 1 day ago

i have same issue on go v1.23.1

asyslinux commented 1 day ago
Hamper commented 13 hours ago

The repository at github.com/ory/viper was archived 4 years ago. The current version of github.com/spf13/viper does not use ristretto.

Ristretto v1 uses generics and may not be compatible with packages that require ristretto without generics. You can try using ristretto v0 (the latest version is v0.2.0).

jney commented 7 hours ago

@Hamper I don't use viper, but I use badger

Hamper commented 7 minutes ago

Badger supports ristretto with generics starting from v4.3.0. Versions v4.2.0 and below do not support generics in the call to newCache and require ristretto v0