eko / gocache

☔️ A complete Go cache library that brings you multiple ways of managing your caches
https://vincent.composieux.fr/article/i-wrote-gocache-a-complete-and-extensible-go-cache-library/
MIT License
2.46k stars 195 forks source link

v4 issues - can't import #186

Closed rwrz closed 1 year ago

rwrz commented 1 year ago

I'm trying to import the v4 but I can't, this error show up:

go: finding module for package github.com/eko/gocache/v4/lib
reallifeglobal.com/common/cache imports
    github.com/eko/gocache/v4/lib: module github.com/eko/gocache@latest found (v1.2.0), but does not contain package github.com/eko/gocache/v4/lib

To reproduce:

fbozzo-sniptech commented 1 year ago

Same here :(

eko commented 1 year ago

Hi,

Thank you and sorry about that.

Imports should now be functional by replacing github.com/eko/gocache/v4/lib with github.com/eko/gocache/lib/v4.

Indeed, the version number of a Go module should be a suffix of the module name.

$ go get github.com/eko/gocache/lib/v4@v4.1.2

Also note that store module names have also beed updated:

go get github.com/eko/gocache/store/bigcache/v4
go get github.com/eko/gocache/store/freecache/v4
go get github.com/eko/gocache/store/go_cache/v4
go get github.com/eko/gocache/store/memcache/v4
go get github.com/eko/gocache/store/pegasus/v4
go get github.com/eko/gocache/store/redis/v4
go get github.com/eko/gocache/store/rediscluster/v4
go get github.com/eko/gocache/store/rueidis/v4
go get github.com/eko/gocache/store/ristretto/v4

Could you please confirm it's working now?

ddliu commented 1 year ago

Same here with go mod tidy error, to reproduce:

package main

import (
    "github.com/eko/gocache/lib/v4/marshaler"
)

func main() {
    marshaler.New(nil)
}

go.mod file:

module app

go 1.19

require github.com/eko/gocache/lib/v4 v4.1.1

require (
    github.com/beorn7/perks v1.0.1 // indirect
    github.com/cespare/xxhash/v2 v2.1.2 // indirect
    github.com/golang/mock v1.6.0 // indirect
    github.com/golang/protobuf v1.5.2 // indirect
    github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
    github.com/prometheus/client_golang v1.14.0 // indirect
    github.com/prometheus/client_model v0.3.0 // indirect
    github.com/prometheus/common v0.37.0 // indirect
    github.com/prometheus/procfs v0.8.0 // indirect
    github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
    golang.org/x/exp v0.0.0-20221126150942-6ab00d035af9 // indirect
    golang.org/x/net v0.0.0-20220225172249-27dd8689420f // indirect
    golang.org/x/sys v0.1.0 // indirect
    google.golang.org/appengine v1.6.6 // indirect
    google.golang.org/protobuf v1.28.1 // indirect
)

Error message when run go mod tidy:

go mod tidy
go: finding module for package github.com/eko/gocache/v4/lib/metrics
go: finding module for package github.com/eko/gocache/v4/lib/cache
go: finding module for package github.com/eko/gocache/v4/lib/codec
go: finding module for package github.com/eko/gocache/v4/lib/store
app imports
        github.com/eko/gocache/lib/v4/marshaler tested by
        github.com/eko/gocache/lib/v4/marshaler.test imports
        github.com/eko/gocache/v4/lib/cache: module github.com/eko/gocache@latest found (v1.2.0), but does not contain package github.com/eko/gocache/v4/lib/cache
app imports
        github.com/eko/gocache/lib/v4/marshaler tested by
        github.com/eko/gocache/lib/v4/marshaler.test imports
        github.com/eko/gocache/v4/lib/store: module github.com/eko/gocache@latest found (v1.2.0), but does not contain package github.com/eko/gocache/v4/lib/store
app imports
        github.com/eko/gocache/lib/v4/marshaler imports
        github.com/eko/gocache/lib/v4/cache tested by
        github.com/eko/gocache/lib/v4/cache.test imports
        github.com/eko/gocache/v4/lib/codec: module github.com/eko/gocache@latest found (v1.2.0), but does not contain package github.com/eko/gocache/v4/lib/codec
app imports
        github.com/eko/gocache/lib/v4/marshaler imports
        github.com/eko/gocache/lib/v4/cache tested by
        github.com/eko/gocache/lib/v4/cache.test imports
        github.com/eko/gocache/v4/lib/metrics: module github.com/eko/gocache@latest found (v1.2.0), but does not contain package github.com/eko/gocache/v4/lib/metrics
eko commented 1 year ago

Thank you @ddliu,

It seems that there is a cache on Go sum database, I just created released v4.1.2 and it seems to be fixed now. Could you please confirm?

ddliu commented 1 year ago

v4.1.2 works for me, thanks.

eko commented 1 year ago

Cool, thanks to you all for your quick feedback.

I close this issue but feel free to reopen if you still have any issue.