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:
Alex Jones
2024-01-04 17:03:32 +00:00
committed by GitHub
parent a77426593d
commit a7e9b486ba
5 changed files with 16 additions and 9 deletions

5
cmd/cache/cache.go vendored
View File

@@ -28,7 +28,10 @@ var CacheCmd = &cobra.Command{
Short: "For working with the cache the results of an analysis", 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.`, 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) { Run: func(cmd *cobra.Command, args []string) {
cmd.Help() err := cmd.Help()
if err != nil {
panic(err)
}
}, },
} }

4
pkg/cache/cache.go vendored
View File

@@ -93,9 +93,9 @@ func GetCacheConfiguration() (ICache, error) {
cache = &FileBasedCache{} cache = &FileBasedCache{}
} }
cache.Configure(cacheInfo) err_config := cache.Configure(cacheInfo)
return cache, nil return cache, err_config
} }
func AddRemoteCache(cacheInfo CacheProvider) error { func AddRemoteCache(cacheInfo CacheProvider) error {

View File

@@ -90,9 +90,9 @@ func (s *S3Cache) Load(key string) (string, error) {
} }
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
buf.ReadFrom(result.Body) _, err_read := buf.ReadFrom(result.Body)
result.Body.Close() result.Body.Close()
return buf.String(), nil return buf.String(), err_read
} }
func (s *S3Cache) List() ([]CacheObjectDetails, error) { func (s *S3Cache) List() ([]CacheObjectDetails, error) {

View File

@@ -1,12 +1,13 @@
package server package server
import ( import (
"github.com/fatih/color"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
"os" "os"
"sync" "sync"
"testing" "testing"
"github.com/fatih/color"
"github.com/stretchr/testify/assert"
"go.uber.org/zap"
) )
func TestServerInit(t *testing.T) { func TestServerInit(t *testing.T) {

View File

@@ -154,7 +154,10 @@ func SliceDiff(source, dest []string) []string {
func MaskString(input string) string { func MaskString(input string) string {
key := make([]byte, len(input)) key := make([]byte, len(input))
result := make([]rune, len(input)) result := make([]rune, len(input))
rand.Read(key) _, err := rand.Read(key)
if err != nil {
panic(err)
}
for i := range result { for i := range result {
result[i] = anonymizePattern[int(key[i])%len(anonymizePattern)] result[i] = anonymizePattern[int(key[i])%len(anonymizePattern)]
} }