gocache icon indicating copy to clipboard operation
gocache copied to clipboard

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

Open kristijorgji opened this issue 3 years ago • 0 comments

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/[email protected]/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/[email protected]
../../../go/pkg/mod/github.com/eko/gocache/[email protected]/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/[email protected]
../../../go/pkg/mod/github.com/eko/gocache/[email protected]/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/[email protected]
../../../go/pkg/mod/github.com/eko/gocache/[email protected]/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/[email protected]
../../../go/pkg/mod/github.com/gin-gonic/[email protected]/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/[email protected]
../../../go/pkg/mod/github.com/eko/gocache/[email protected]/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/[email protected]
../../../go/pkg/mod/github.com/eko/gocache/[email protected]/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/[email protected]
../../../go/pkg/mod/github.com/eko/gocache/[email protected]/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/[email protected]
../../../go/pkg/mod/github.com/eko/gocache/[email protected]/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/[email protected]
../../../go/pkg/mod/github.com/eko/gocache/[email protected]/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/[email protected]
make: *** [build] Error 1

kristijorgji avatar Aug 09 '22 16:08 kristijorgji