Skip to content

Commit

Permalink
Upgrade go version to 1.23 (#157)
Browse files Browse the repository at this point in the history
* Upgrade go to 1.23

Signed-off-by: thepetk <[email protected]>

* Fix linting tool

Signed-off-by: thepetk <[email protected]>

* Update gosec

Signed-off-by: thepetk <[email protected]>

* Update upload-artifact

Signed-off-by: thepetk <[email protected]>

---------

Signed-off-by: thepetk <[email protected]>
  • Loading branch information
thepetk authored Jan 23, 2025
1 parent 12cf9c8 commit 72d50fe
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: SARIF file
path: results.sarif
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ check_registry: ## Run registry checks

.PHONY: gosec_install
gosec_install: ## Install gosec utility
go install github.com/securego/gosec/v2/cmd/gosec@v2.14.0
go install github.com/securego/gosec/v2/cmd/gosec@v2.22.0

.PHONY: gosec
gosec: ## Run go security checks
Expand All @@ -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/[email protected]
go install github.com/golangci/golangci-lint/cmd/[email protected]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/devfile/alizer

go 1.21
go 1.23

require (
github.com/go-git/go-git/v5 v5.13.1
Expand Down
8 changes: 4 additions & 4 deletions test/apis/component_recognizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
}

Expand Down Expand Up @@ -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
Expand All @@ -413,15 +413,15 @@ 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)))
}
}

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)))
}
}

Expand Down
2 changes: 1 addition & 1 deletion test/apis/language_recognizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
8 changes: 4 additions & 4 deletions test/apis/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
}

Expand All @@ -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
}
Expand Down

0 comments on commit 72d50fe

Please sign in to comment.