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.42k stars 192 forks source link

[Error While Compiling] Missing go.sum for X, Y, Z after installing the library #165

Closed kristijorgji closed 1 year ago

kristijorgji commented 2 years ago

I installed the library as documented

go get github.com/eko/gocache/v3

then I installed the in-memory store

go get github.com/patrickmn/go-cache

And I have a code without any syntax error like this

package main

import (
    "context"
    "fmt"
    "github.com/eko/gocache/v3/cache"
    "github.com/eko/gocache/v3/store"
    gocache "github.com/patrickmn/go-cache"
    "time"
)

func main() {
    cacheManager, _ := createCache()
    err := cacheManager.Set(context.Background(), "my-key", []byte("my-value"))
    if err != nil {
        panic(err)
    }

    value, err := cacheManager.Get(context.Background(), "my-key")
    if err != nil {
        panic(err)
    }
    fmt.Printf("%s", value)

}

func createCache() (*cache.Cache[[]byte], error) {
    gocacheClient := gocache.New(5*time.Minute, 10*time.Minute)
    gocacheStore := store.NewGoCache(gocacheClient)
    cacheManager := cache.New[[]byte](gocacheStore)

    return cacheManager, nil
}

When trying to compile I get error as below (yes I tried also go mod tidy and did not help)

../../../go/pkg/mod/github.com/eko/gocache/v3@v3.1.1/store/pegasus.go:10:2: missing go.sum entry for module providing package github.com/XiaoMi/pegasus-go-client/admin (imported by github.com/eko/gocache/v3/store); to add:
        go get github.com/eko/gocache/v3/store@v3.1.1
../../../go/pkg/mod/github.com/eko/gocache/v3@v3.1.1/store/pegasus.go:11:2: missing go.sum entry for module providing package github.com/XiaoMi/pegasus-go-client/pegasus (imported by github.com/eko/gocache/v3/store); to add:
        go get github.com/eko/gocache/v3/store@v3.1.1
../../../go/pkg/mod/github.com/eko/gocache/v3@v3.1.1/store/memcache.go:12:2: missing go.sum entry for module providing package github.com/bradfitz/gomemcache/memcache (imported by github.com/eko/gocache/v3/store); to add:
        go get github.com/eko/gocache/v3/store@v3.1.1
../../../go/pkg/mod/github.com/eko/gocache/v3@v3.1.1/store/redis.go:8:2: missing go.sum entry for module providing package github.com/go-redis/redis/v8 (imported by github.com/eko/gocache/v3/store); to add:
        go get github.com/eko/gocache/v3/store@v3.1.1
../../../go/pkg/mod/github.com/gin-gonic/gin@v1.6.3/binding/protobuf.go:11:2: missing go.sum entry for module providing package github.com/golang/protobuf/proto (imported by github.com/gin-gonic/gin/binding); to add:
        go get github.com/gin-gonic/gin/binding@v1.6.3
../../../go/pkg/mod/github.com/eko/gocache/v3@v3.1.1/metrics/prometheus.go:5:2: missing go.sum entry for module providing package github.com/prometheus/client_golang/prometheus (imported by github.com/eko/gocache/v3/metrics); to add:
        go get github.com/eko/gocache/v3/metrics@v3.1.1
../../../go/pkg/mod/github.com/eko/gocache/v3@v3.1.1/metrics/prometheus.go:6:2: missing go.sum entry for module providing package github.com/prometheus/client_golang/prometheus/promauto (imported by github.com/eko/gocache/v3/metrics); to add:
        go get github.com/eko/gocache/v3/metrics@v3.1.1
../../../go/pkg/mod/github.com/eko/gocache/v3@v3.1.1/store/pegasus.go:12:2: missing go.sum entry for module providing package github.com/spf13/cast (imported by github.com/eko/gocache/v3/store); to add:
        go get github.com/eko/gocache/v3/store@v3.1.1
../../../go/pkg/mod/github.com/eko/gocache/v3@v3.1.1/store/options_test_matchers.go:7:2: missing go.sum entry for module providing package golang.org/x/exp/slices (imported by github.com/eko/gocache/v3/store); to add:
        go get github.com/eko/gocache/v3/store@v3.1.1
../../../go/pkg/mod/github.com/eko/gocache/v3@v3.1.1/store/memcache.go:10:2: missing go.sum entry for module providing package golang.org/x/sync/errgroup (imported by github.com/eko/gocache/v3/store); to add:
        go get github.com/eko/gocache/v3/store@v3.1.1
make: *** [build] Error 1
eko commented 1 year ago

Hello, the pegasus store is now in a separated Go module so this should be fixed in case you only use the Gocache library (by importing github.com/eko/gocache/v4/lib).

I close this issue for now but feel free to reopen if you still have any issue with this new v4.0.0 release.