Skip to content

Commit

Permalink
chore: lint fixes (#833)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
AlexsJones committed Jan 4, 2024
1 parent a774265 commit a7e9b48
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
5 changes: 4 additions & 1 deletion cmd/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
},
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/cache/s3_based.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 4 additions & 3 deletions pkg/server/server_test.go
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
}
Expand Down

0 comments on commit a7e9b48

Please sign in to comment.