[Error While Compiling] Missing go.sum for X, Y, Z after installing the library
kristijorgji opened this issue · 1 comments
kristijorgji commented
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