diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 5ab3f0ab5..617525a37 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v2 with: - go-version: 1.18 + go-version: 1.19 - name: Run tests run: make test - name: Codecov diff --git a/.github/workflows/pact_postmerge.yml b/.github/workflows/pact_postmerge.yml index 4d2b707bd..14f10e40e 100644 --- a/.github/workflows/pact_postmerge.yml +++ b/.github/workflows/pact_postmerge.yml @@ -13,7 +13,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v2 with: - go-version: 1.18 + go-version: 1.19 - name: Check out code into the Go module directory uses: actions/checkout@v2 with: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 054cb0553..3ecfd0138 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -15,7 +15,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v2 with: - go-version: 1.18 + go-version: 1.19 - name: Check out code into the Go module directory uses: actions/checkout@v2 with: @@ -69,9 +69,9 @@ jobs: git --no-pager diff exit 1 fi - - uses: dominikh/staticcheck-action@v1.2.0 + - uses: dominikh/staticcheck-action@v1.3.0 with: - version: "2022.1" + version: "2022.1.3" install-go: false - name: Check manifests run: | @@ -133,7 +133,7 @@ jobs: - name: Set up Go 1.x uses: actions/setup-go@v2 with: - go-version: 1.18 + go-version: 1.19 - name: Check out code into the Go module directory uses: actions/checkout@v2 with: diff --git a/Dockerfile b/Dockerfile index 0f954b321..fa07d5c10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.18 as builder +FROM golang:1.19 as builder WORKDIR /workspace # Copy the Go Modules manifests diff --git a/cdq-analysis/go.mod b/cdq-analysis/go.mod index 448117d55..92106aa55 100644 --- a/cdq-analysis/go.mod +++ b/cdq-analysis/go.mod @@ -1,6 +1,6 @@ module github.com/redhat-appstudio/application-service/cdq-analysis -go 1.18 +go 1.19 require ( github.com/devfile/api/v2 v2.2.1-alpha.0.20230413012049-a6c32fca0dbd diff --git a/cdq-analysis/main.go b/cdq-analysis/main.go index 3df3f1971..bad1bf49c 100644 --- a/cdq-analysis/main.go +++ b/cdq-analysis/main.go @@ -1,11 +1,10 @@ -// // Copyright 2023 Red Hat, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, diff --git a/cdq-analysis/pkg/detect.go b/cdq-analysis/pkg/detect.go index 4e9327872..117b189f9 100644 --- a/cdq-analysis/pkg/detect.go +++ b/cdq-analysis/pkg/detect.go @@ -17,7 +17,7 @@ package pkg import ( "fmt" - "io/ioutil" + "os" "path" "reflect" "strings" @@ -52,7 +52,7 @@ func search(log logr.Logger, a Alizer, localpath string, devfileRegistryURL stri dockerfileContextMapFromRepo := make(map[string]string) componentPortsMapFromRepo := make(map[string][]int) - files, err := ioutil.ReadDir(localpath) + files, err := os.ReadDir(localpath) if err != nil { return nil, nil, nil, nil, err } @@ -63,7 +63,7 @@ func search(log logr.Logger, a Alizer, localpath string, devfileRegistryURL stri isDockerfilePresent := false curPath := path.Join(localpath, f.Name()) context := path.Join(srcContext, f.Name()) - files, err := ioutil.ReadDir(curPath) + files, err := os.ReadDir(curPath) if err != nil { return nil, nil, nil, nil, err } @@ -93,7 +93,7 @@ func search(log logr.Logger, a Alizer, localpath string, devfileRegistryURL stri // if the dir is .devfile, we dont increment currentLevel // consider devfile.yaml and .devfile/devfile.yaml as the same level, for example hiddenDirPath := path.Join(curPath, HiddenDevfileDir) - hiddenfiles, err := ioutil.ReadDir(hiddenDirPath) + hiddenfiles, err := os.ReadDir(hiddenDirPath) if err != nil { return nil, nil, nil, nil, err } @@ -140,7 +140,7 @@ func search(log logr.Logger, a Alizer, localpath string, devfileRegistryURL stri // OR docker/Containerfile, .docker/Containerfile and build/Containerfile dirName := f.Name() dirPath := path.Join(curPath, dirName) - files, err := ioutil.ReadDir(dirPath) + files, err := os.ReadDir(dirPath) if err != nil { return nil, nil, nil, nil, err } diff --git a/cdq-analysis/pkg/detect_mock.go b/cdq-analysis/pkg/detect_mock.go index 128c21b72..31e541f74 100644 --- a/cdq-analysis/pkg/detect_mock.go +++ b/cdq-analysis/pkg/detect_mock.go @@ -179,7 +179,7 @@ func (a MockAlizerClient) DetectComponents(path string) ([]model.Component, erro "Mux", }, Tools: []string{ - "1.18", + "1.19", }, Weight: 100, CanBeComponent: true, diff --git a/cdq-analysis/pkg/devfile_test.go b/cdq-analysis/pkg/devfile_test.go index 19b2b0c2b..c68fc581b 100644 --- a/cdq-analysis/pkg/devfile_test.go +++ b/cdq-analysis/pkg/devfile_test.go @@ -16,7 +16,6 @@ package pkg import ( - "io/ioutil" "net" "net/http" "net/http/httptest" @@ -76,7 +75,7 @@ schemaVersion: 2.2.0` if err != nil { t.Errorf("TestParseDevfileModel() error: failed to create folder: %v, error: %v", localPath, err) } - err = ioutil.WriteFile(localDevfilePath, []byte(simpleDevfile), 0644) + err = os.WriteFile(localDevfilePath, []byte(simpleDevfile), 0644) if err != nil { t.Errorf("TestParseDevfileModel() error: fail to write to file: %v", err) } diff --git a/cdq-analysis/pkg/util.go b/cdq-analysis/pkg/util.go index d1c43ae4e..1cb13a447 100644 --- a/cdq-analysis/pkg/util.go +++ b/cdq-analysis/pkg/util.go @@ -17,7 +17,7 @@ package pkg import ( "fmt" - "io/ioutil" + "io" "net/http" "net/url" "os" @@ -100,7 +100,7 @@ func CurlEndpoint(endpoint string) ([]byte, error) { defer resp.Body.Close() if resp.StatusCode == http.StatusOK { - respBytes, err = ioutil.ReadAll(resp.Body) + respBytes, err = io.ReadAll(resp.Body) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index 91c2a3e06..36c439135 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/redhat-appstudio/application-service -go 1.18 +go 1.19 require ( github.com/brianvoe/gofakeit/v6 v6.9.0 diff --git a/pkg/github/mock.go b/pkg/github/mock.go index 6dbad0ace..08329e39b 100644 --- a/pkg/github/mock.go +++ b/pkg/github/mock.go @@ -16,7 +16,7 @@ package github import ( - "io/ioutil" + "io" "net/http" "strings" @@ -44,7 +44,7 @@ func GetMockedClient() *github.Client { mock.WithRequestMatchHandler( mock.PostOrgsReposByOrg, http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - b, _ := ioutil.ReadAll(req.Body) + b, _ := io.ReadAll(req.Body) reqBody := string(b) // ToDo: Figure out a better way to dynamically mock errors if strings.Contains(reqBody, "test-error-response") || strings.Contains(reqBody, "test-server-error-response") || strings.Contains(reqBody, "test-server-error-response-2") { diff --git a/pkg/util/ioutils/ioutils.go b/pkg/util/ioutils/ioutils.go index 6152fee0b..6d6757881 100644 --- a/pkg/util/ioutils/ioutils.go +++ b/pkg/util/ioutils/ioutils.go @@ -62,7 +62,7 @@ func CreateTempPath(prefix string, appFs afero.Afero) (string, error) { // Used in cases where we're cleaning up after encountering an error, but want to return the original error instead. func RemoveFolderAndLogError(log logr.Logger, fs afero.Fs, path string) { if path != "" { - err := fs.RemoveAll(path) + err := os.RemoveAll(path) if err != nil { log.Error(err, fmt.Sprintf("Unable to delete folder %s", path)) } diff --git a/pkg/util/util.go b/pkg/util/util.go index cf7dbe910..5f5d25381 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -19,7 +19,7 @@ import ( "crypto/sha256" "encoding/base64" "fmt" - "io/ioutil" + "io" "math/rand" "net/http" "net/url" @@ -155,7 +155,7 @@ func CurlEndpoint(endpoint string) ([]byte, error) { defer resp.Body.Close() if resp.StatusCode == http.StatusOK { - respBytes, err = ioutil.ReadAll(resp.Body) + respBytes, err = io.ReadAll(resp.Body) if err != nil { return nil, err }