diff --git a/files/list_test.go b/files/list_test.go index adcfc80..fb9138c 100644 --- a/files/list_test.go +++ b/files/list_test.go @@ -261,11 +261,11 @@ var testCasesListFiles = map[string]listFilesTest{ }, preRun: func() { // create an empty directory - os.Mkdir(filepath.Join(wd, "test_data/list_test3/a/empty"), 0644) + _ = os.Mkdir(filepath.Join(wd, "test_data/list_test3/a/empty"), 0644) }, postRun: func() { // remove empty directory - os.RemoveAll(filepath.Join(wd, "test_data/list_test3/a/empty")) + _ = os.RemoveAll(filepath.Join(wd, "test_data/list_test3/a/empty")) }, expected: []string{ "test_data/list_test3/.steampipe", @@ -286,7 +286,7 @@ var testCasesListFiles = map[string]listFilesTest{ }, preRun: func() { // create an empty directory - os.Mkdir(filepath.Join(wd, "test_data/list_test3/a/empty"), 0644) + _ = os.Mkdir(filepath.Join(wd, "test_data/list_test3/a/empty"), 0644) }, postRun: func() { // remove empty directory diff --git a/files/match_test.go b/files/match_test.go index 748707f..724a03d 100644 --- a/files/match_test.go +++ b/files/match_test.go @@ -1,7 +1,7 @@ package files import ( - "github.com/turbot/go-kit/helpers" + "slices" "testing" ) @@ -125,7 +125,7 @@ var matchTests = map[string]matchTestCase{ func TestMatch(t *testing.T) { var testNames = []string{} for name, test := range matchTests { - if len(testNames) > 0 && !helpers.StringSliceContains(testNames, name) { + if len(testNames) > 0 && !slices.Contains(testNames, name) { continue } actual := Match(test.pattern, test.file) diff --git a/helpers/errors.go b/helpers/errors.go index 70ae6a2..6153fc8 100644 --- a/helpers/errors.go +++ b/helpers/errors.go @@ -1,28 +1,29 @@ package helpers import ( + "errors" "fmt" "strings" ) -func CombineErrorsWithPrefix(prefix string, errors ...error) error { - if len(errors) == 0 { +func CombineErrorsWithPrefix(prefix string, errorList ...error) error { + if len(errorList) == 0 { return nil } - if len(errors) == 1 { + if len(errorList) == 1 { if len(prefix) == 0 { - return errors[0] + return errorList[0] } else { - return fmt.Errorf("%s - %s", prefix, errors[0].Error()) + return fmt.Errorf("%s - %s", prefix, errorList[0].Error()) } } combinedErrorString := []string{prefix} - for _, e := range errors { + for _, e := range errorList { combinedErrorString = append(combinedErrorString, e.Error()) } - return fmt.Errorf(strings.Join(combinedErrorString, "\n\t")) + return errors.New(strings.Join(combinedErrorString, "\n\t")) } func CombineErrors(errors ...error) error { diff --git a/logging/rotatinglogwriter.go b/logging/rotatinglogwriter.go index 2d345f5..15c7df5 100644 --- a/logging/rotatinglogwriter.go +++ b/logging/rotatinglogwriter.go @@ -50,6 +50,7 @@ func (w *RotatingLogWriter) Write(p []byte) (n int, err error) { w.currentWriter, err = os.OpenFile(w.currentPath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) if err != nil { err = fmt.Errorf("failed to open steampipe log file: %s", err.Error()) + return 0, err } } diff --git a/types/type_checks_test.go b/types/type_checks_test.go index e36af73..8ba389b 100644 --- a/types/type_checks_test.go +++ b/types/type_checks_test.go @@ -21,7 +21,6 @@ type typeCheckInput struct { _uint64 uint64 _float32 float32 _float64 float64 - _byte byte // is this required as it's an alias for uint8? _bool bool _slice []string _array [3]string