mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-25 15:00:34 +00:00
chore: lint fixes (#833)
* chore: added basic server startup test Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * chore: refactored wg.add move Signed-off-by: Alex Jones <alexsimonjones@gmail.com> --------- Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
This commit is contained in:
5
cmd/cache/cache.go
vendored
5
cmd/cache/cache.go
vendored
@@ -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)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
4
pkg/cache/cache.go
vendored
4
pkg/cache/cache.go
vendored
@@ -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 {
|
||||
|
4
pkg/cache/s3_based.go
vendored
4
pkg/cache/s3_based.go
vendored
@@ -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) {
|
||||
|
@@ -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) {
|
||||
|
@@ -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)]
|
||||
}
|
||||
|
Reference in New Issue
Block a user