diff --git a/.golangci.yml b/.golangci.yml index 6249651..568657c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,8 +3,6 @@ linters: enable: - asciicheck - bodyclose - - deadcode - - depguard - dogsled - errcheck - exportloopref @@ -19,7 +17,6 @@ linters: - gosec - gosimple - govet - - ifshort - importas - ineffassign - misspell @@ -32,16 +29,15 @@ linters: - revive - rowserrcheck - staticcheck - - structcheck - stylecheck - thelper - typecheck - unconvert - unparam - unused - - varcheck - whitespace - +disable: + - depguard # Disabling because it is causing CI to break. See issue https://github.com/golangci/golangci-lint/issues/3906 fore more run: skip-files: - "kubernetes/.*" diff --git a/cmd/root.go b/cmd/root.go index 37820d1..03c89d8 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -24,7 +24,6 @@ import ( "go.uber.org/zap" "go.uber.org/zap/zapcore" "k8s.io/client-go/tools/clientcmd" - "sigs.k8s.io/windows-operational-readiness/pkg/flags" "sigs.k8s.io/windows-operational-readiness/pkg/testcases" ) diff --git a/pkg/testcases/cases.go b/pkg/testcases/cases.go index 4829598..7b2f8fe 100644 --- a/pkg/testcases/cases.go +++ b/pkg/testcases/cases.go @@ -26,7 +26,6 @@ import ( "strconv" "go.uber.org/zap" - "sigs.k8s.io/windows-operational-readiness/pkg/report" ) @@ -167,10 +166,8 @@ func CleanupJUnitXML(path string) error { if cleanContent, err = xml.MarshalIndent(testSuites, " ", " "); err != nil { return err } - if err = writeFileContent(path, cleanContent); err != nil { - return err - } - return nil + + return writeFileContent(path, cleanContent) } // writeFileContent save the content to a file. diff --git a/pkg/testcases/context.go b/pkg/testcases/context.go index f294bc5..d294632 100644 --- a/pkg/testcases/context.go +++ b/pkg/testcases/context.go @@ -24,7 +24,6 @@ import ( "go.uber.org/zap" "gopkg.in/yaml.v3" - "sigs.k8s.io/windows-operational-readiness/pkg/flags" ) @@ -101,7 +100,7 @@ func getTestFiles(testDirectory string) ([]string, error) { return nil, err } - testDirectory = testDirectory + "/specifications/" + testDirectory += "/specifications/" } testFiles := make([]string, 0) diff --git a/pkg/testcases/validation.go b/pkg/testcases/validation.go index ff805e7..510fffd 100644 --- a/pkg/testcases/validation.go +++ b/pkg/testcases/validation.go @@ -17,8 +17,6 @@ limitations under the License. package testcases import ( - "fmt" - "github.com/go-playground/validator/v10" "go.uber.org/zap" ) @@ -27,17 +25,14 @@ import ( func (s *Specification) validateYAML() error { validate := validator.New() validate.RegisterStructValidation(SpecificationValidation, Specification{}) - if err := validate.Struct(s); err != nil { - return err - } - return nil + return validate.Struct(s) } // SpecificationValidation set the required fields and is used by the validator function. func SpecificationValidation(sl validator.StructLevel) { specification := sl.Current().Interface().(Specification) if specification.Category == "" { - zap.L().Error(fmt.Sprintf("Category Required")) + zap.L().Error("Category Required") sl.ReportError(specification.Category, "category", "Category", "categoryRequired", "") } for _, testCase := range specification.TestCases {