diff --git a/cmd/cache/cache.go b/cmd/cache/cache.go index c7418dbb18..27042aa6fa 100644 --- a/cmd/cache/cache.go +++ b/cmd/cache/cache.go @@ -28,7 +28,10 @@ var CacheCmd = &cobra.Command{ Short: "For working with the cache the results of an analysis", Long: `Cache commands allow you to add a remote cache, list the contents of the cache, and remove items from the cache.`, Run: func(cmd *cobra.Command, args []string) { - cmd.Help() + err := cmd.Help() + if err != nil { + panic(err) + } }, } diff --git a/pkg/cache/cache.go b/pkg/cache/cache.go index dcb0b0b117..90006ca76e 100644 --- a/pkg/cache/cache.go +++ b/pkg/cache/cache.go @@ -93,9 +93,9 @@ func GetCacheConfiguration() (ICache, error) { cache = &FileBasedCache{} } - cache.Configure(cacheInfo) + err_config := cache.Configure(cacheInfo) - return cache, nil + return cache, err_config } func AddRemoteCache(cacheInfo CacheProvider) error { diff --git a/pkg/cache/s3_based.go b/pkg/cache/s3_based.go index 19e4f46d49..91c998d64a 100644 --- a/pkg/cache/s3_based.go +++ b/pkg/cache/s3_based.go @@ -90,9 +90,9 @@ func (s *S3Cache) Load(key string) (string, error) { } buf := new(bytes.Buffer) - buf.ReadFrom(result.Body) + _, err_read := buf.ReadFrom(result.Body) result.Body.Close() - return buf.String(), nil + return buf.String(), err_read } func (s *S3Cache) List() ([]CacheObjectDetails, error) { diff --git a/pkg/server/server_test.go b/pkg/server/server_test.go index 98d9743cb1..ef76f83d06 100644 --- a/pkg/server/server_test.go +++ b/pkg/server/server_test.go @@ -1,12 +1,13 @@ package server import ( - "github.com/fatih/color" - "github.com/stretchr/testify/assert" - "go.uber.org/zap" "os" "sync" "testing" + + "github.com/fatih/color" + "github.com/stretchr/testify/assert" + "go.uber.org/zap" ) func TestServerInit(t *testing.T) { diff --git a/pkg/util/util.go b/pkg/util/util.go index 9ad38ac4bf..76c0feff61 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -154,7 +154,10 @@ func SliceDiff(source, dest []string) []string { func MaskString(input string) string { key := make([]byte, len(input)) result := make([]rune, len(input)) - rand.Read(key) + _, err := rand.Read(key) + if err != nil { + panic(err) + } for i := range result { result[i] = anonymizePattern[int(key[i])%len(anonymizePattern)] }