From fbf4cdeebbf2ff6e9de7a3938d6a0de10ef03c51 Mon Sep 17 00:00:00 2001 From: thepetk Date: Wed, 22 Jan 2025 15:58:15 +0000 Subject: [PATCH] Fix linting tool Signed-off-by: thepetk --- Makefile | 3 +-- test/apis/component_recognizer_test.go | 8 ++++---- test/apis/language_recognizer_test.go | 2 +- test/apis/utils.go | 8 ++++---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 49faa147..28e56035 100644 --- a/Makefile +++ b/Makefile @@ -40,5 +40,4 @@ lint: ## Run golangci-lint linter tool .PHONY: lint_install lint_install: ## Install golangci-lint linter tool - @# TODO(rm3l): recent versions of golangci-lint require Go >= 1.20. Update when we start using Go 1.20+ - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.3 + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.63.4 diff --git a/test/apis/component_recognizer_test.go b/test/apis/component_recognizer_test.go index f3d23ec0..bee75fc8 100644 --- a/test/apis/component_recognizer_test.go +++ b/test/apis/component_recognizer_test.go @@ -361,7 +361,7 @@ func TestPortDetectionFlaskStringValue(t *testing.T) { func TestComponentDetectionNoResult(t *testing.T) { components := getComponentsFromTestProject(t, "simple") if len(components) > 0 { - t.Errorf("Expected 0 components but found " + strconv.Itoa(len(components))) + t.Errorf("Expected 0 components but found %v", strconv.Itoa(len(components))) } } @@ -395,7 +395,7 @@ func TestComponentDetectionWithGitIgnoreRule(t *testing.T) { components := getComponentsFromFiles(t, files, settings) if len(components) != 1 { - t.Errorf("Expected 1 components but found " + strconv.Itoa(len(components))) + t.Errorf("Expected 1 components but found %v", strconv.Itoa(len(components))) } //now add a gitIgnore with a rule to exclude the only component found @@ -413,7 +413,7 @@ func TestComponentDetectionWithGitIgnoreRule(t *testing.T) { os.Remove(gitIgnorePath) if len(componentsWithUpdatedGitIgnore) != 0 { - t.Errorf("Expected 0 components but found " + strconv.Itoa(len(componentsWithUpdatedGitIgnore))) + t.Errorf("Expected 0 components but found %v", strconv.Itoa(len(componentsWithUpdatedGitIgnore))) } } @@ -421,7 +421,7 @@ func TestComponentDetectionMultiProjects(t *testing.T) { components := getComponentsFromTestProject(t, "") nComps := 70 if len(components) != nComps { - t.Errorf("Expected " + strconv.Itoa(nComps) + " components but found " + strconv.Itoa(len(components))) + t.Errorf("Expected %v components but found %v", strconv.Itoa(nComps), strconv.Itoa(len(components))) } } diff --git a/test/apis/language_recognizer_test.go b/test/apis/language_recognizer_test.go index ff33518d..ed8b1920 100644 --- a/test/apis/language_recognizer_test.go +++ b/test/apis/language_recognizer_test.go @@ -63,7 +63,7 @@ func isLanguageInProject(t *testing.T, project string, wantedLanguage string, wa } if !hasWantedLanguage(languages, wantedLanguage, wantedTools, wantedFrameworks) { - t.Errorf("Project does not use " + wantedLanguage + " language") + t.Errorf("Project does not use %v language", wantedLanguage) } } diff --git a/test/apis/utils.go b/test/apis/utils.go index 927633ce..120f4d00 100644 --- a/test/apis/utils.go +++ b/test/apis/utils.go @@ -61,16 +61,16 @@ func verifyComponents(t *testing.T, components []model.Component, expectedNumber if hasComponents { isExpectedComponent := strings.EqualFold(expectedLanguage, components[0].Languages[0].Name) if !isExpectedComponent { - t.Errorf("Project does not use " + expectedLanguage + " language") + t.Errorf("Project does not use %v language ", expectedLanguage) } if expectedProjectName != "" { isExpectedProjectName := strings.EqualFold(expectedProjectName, components[0].Name) if !isExpectedProjectName { - t.Errorf("Main component has a different project name. Expected " + expectedProjectName + " but it was " + components[0].Name) + t.Errorf("Main component has a different project name. Expected %v but it was %v", expectedProjectName, components[0].Name) } } } else { - t.Errorf("Expected " + strconv.Itoa(expectedNumber) + " of components but it was " + strconv.Itoa(len(components))) + t.Errorf("Expected %v of components but it was %v", strconv.Itoa(expectedNumber), strconv.Itoa(len(components))) } } @@ -94,7 +94,7 @@ func testPortDetectionInProject(t *testing.T, project string, ports []int) { } } if !found { - t.Errorf("Port " + strconv.Itoa(port) + " have not been detected") + t.Errorf("Port %v have not been detected", strconv.Itoa(port)) } found = false }