diff --git a/.github/workflows/accessTests.yml b/.github/workflows/accessTests.yml index d8a5a1859..75d1ce039 100644 --- a/.github/workflows/accessTests.yml +++ b/.github/workflows/accessTests.yml @@ -21,7 +21,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Go Cache uses: actions/cache@v3 with: diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index f903ff6ab..5ffd708c1 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -15,7 +15,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Checkout code uses: actions/checkout@v3 with: @@ -37,7 +37,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Static Code Analysis uses: dominikh/staticcheck-action@v1 with: @@ -51,7 +51,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Install gosec run: curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin - name: Run gosec diff --git a/.github/workflows/artifactoryTests.yml b/.github/workflows/artifactoryTests.yml index 757754e09..a06523f38 100644 --- a/.github/workflows/artifactoryTests.yml +++ b/.github/workflows/artifactoryTests.yml @@ -22,7 +22,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Checkout code uses: actions/checkout@v3 with: diff --git a/.github/workflows/distributionTests.yml b/.github/workflows/distributionTests.yml index d853e450f..3a876885e 100644 --- a/.github/workflows/distributionTests.yml +++ b/.github/workflows/distributionTests.yml @@ -21,7 +21,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Go Cache uses: actions/cache@v3 with: diff --git a/.github/workflows/dockerTests.yml b/.github/workflows/dockerTests.yml index 8435f2201..1de1c39a5 100644 --- a/.github/workflows/dockerTests.yml +++ b/.github/workflows/dockerTests.yml @@ -17,7 +17,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Checkout code uses: actions/checkout@v3 with: diff --git a/.github/workflows/frogbot-scan-and-fix.yml b/.github/workflows/frogbot-scan-and-fix.yml index fa7dc724b..e1d070a88 100644 --- a/.github/workflows/frogbot-scan-and-fix.yml +++ b/.github/workflows/frogbot-scan-and-fix.yml @@ -19,7 +19,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - uses: jfrog/frogbot@v2 env: diff --git a/.github/workflows/frogbot-scan-pr.yml b/.github/workflows/frogbot-scan-pr.yml index 8ab7bb99d..f9aa32a75 100644 --- a/.github/workflows/frogbot-scan-pr.yml +++ b/.github/workflows/frogbot-scan-pr.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - uses: jfrog/frogbot@v2 env: diff --git a/.github/workflows/goTests.yml b/.github/workflows/goTests.yml index d5395afc7..5522affcf 100644 --- a/.github/workflows/goTests.yml +++ b/.github/workflows/goTests.yml @@ -22,7 +22,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Checkout code uses: actions/checkout@v3 with: diff --git a/.github/workflows/gradleTests.yml b/.github/workflows/gradleTests.yml index 9a210a0bb..f45323b4c 100644 --- a/.github/workflows/gradleTests.yml +++ b/.github/workflows/gradleTests.yml @@ -23,7 +23,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Checkout code uses: actions/checkout@v3 with: diff --git a/.github/workflows/mavenTests.yml b/.github/workflows/mavenTests.yml index c9f2c1ba4..9c53837f8 100644 --- a/.github/workflows/mavenTests.yml +++ b/.github/workflows/mavenTests.yml @@ -21,7 +21,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Checkout code uses: actions/checkout@v3 with: diff --git a/.github/workflows/npmTests.yml b/.github/workflows/npmTests.yml index 146eac597..caeb1af42 100644 --- a/.github/workflows/npmTests.yml +++ b/.github/workflows/npmTests.yml @@ -21,7 +21,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Install npm uses: actions/setup-node@v3 with: diff --git a/.github/workflows/nugetTests.yml b/.github/workflows/nugetTests.yml index 91a08327c..37ca37539 100644 --- a/.github/workflows/nugetTests.yml +++ b/.github/workflows/nugetTests.yml @@ -21,7 +21,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Install NuGet uses: nuget/setup-nuget@v1 with: diff --git a/.github/workflows/pluginsTests.yml b/.github/workflows/pluginsTests.yml index 646940493..9931bcad7 100644 --- a/.github/workflows/pluginsTests.yml +++ b/.github/workflows/pluginsTests.yml @@ -21,7 +21,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Checkout code uses: actions/checkout@v3 with: diff --git a/.github/workflows/pythonTests.yml b/.github/workflows/pythonTests.yml index 66175d738..ddc20084b 100644 --- a/.github/workflows/pythonTests.yml +++ b/.github/workflows/pythonTests.yml @@ -22,7 +22,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Setup Python3 uses: actions/setup-python@v4 with: diff --git a/.github/workflows/transferTests.yml b/.github/workflows/transferTests.yml index c8bf59998..728eb647a 100644 --- a/.github/workflows/transferTests.yml +++ b/.github/workflows/transferTests.yml @@ -25,7 +25,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Go Cache uses: actions/cache@v3 with: diff --git a/.github/workflows/xrayTests.yml b/.github/workflows/xrayTests.yml index f21938d89..f0f418ccc 100644 --- a/.github/workflows/xrayTests.yml +++ b/.github/workflows/xrayTests.yml @@ -23,7 +23,7 @@ jobs: - name: Install Go uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Install npm uses: actions/setup-node@v3 with: diff --git a/Jenkinsfile b/Jenkinsfile index cc2c6c0ea..30e7ffcc9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,7 @@ node("docker") { repo = 'jfrog-cli' sh 'rm -rf temp' sh 'mkdir temp' - def goRoot = tool 'go-1.18.5' + def goRoot = tool 'go-1.19.2' env.GOROOT="$goRoot" env.PATH+=":${goRoot}/bin" env.GO111MODULE="on" diff --git a/README.md b/README.md index 66be4fe74..c494dcb5b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![Go Report Card](https://goreportcard.com/badge/github.com/jfrog/jfrog-cli)](https://goreportcard.com/report/github.com/jfrog/jfrog-cli) [![license](https://img.shields.io/badge/License-Apache_2.0-blue.svg?style=flat)](https://raw.githubusercontent.com/jfrog/jfrog-cli/v2/LICENSE) [![](https://img.shields.io/badge/Docs-%F0%9F%93%96-blue)](https://www.jfrog.com/confluence/display/CLI/JFrog+CLI) - +[![Go version](https://img.shields.io/github/go-mod/go-version/jfrog/jfrog-cli)](https://tip.golang.org/doc/go1.19)
diff --git a/artifactory/cli.go b/artifactory/cli.go index 1d4dbcedb..93ebbfe60 100644 --- a/artifactory/cli.go +++ b/artifactory/cli.go @@ -3,7 +3,6 @@ package artifactory import ( "errors" "fmt" - "io/ioutil" "os" "strconv" "strings" @@ -2189,7 +2188,7 @@ func usersDeleteCmd(c *cli.Context) error { func parseCSVToUsersList(csvFilePath string) ([]services.User, error) { var usersList []services.User - csvInput, err := ioutil.ReadFile(csvFilePath) + csvInput, err := os.ReadFile(csvFilePath) if err != nil { return usersList, errorutils.CheckError(err) } diff --git a/artifactory_test.go b/artifactory_test.go index 0e6764417..f18e1c3f1 100644 --- a/artifactory_test.go +++ b/artifactory_test.go @@ -8,7 +8,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net" "net/http" "net/url" @@ -1900,7 +1899,7 @@ func createFileInHomeDir(t *testing.T, fileName string) (testFileRelPath string, testFileRelPath = filepath.Join("~", fileName) testFileAbsPath = filepath.Join(fileutils.GetHomeDir(), fileName) d1 := []byte("test file") - err := ioutil.WriteFile(testFileAbsPath, d1, 0644) + err := os.WriteFile(testFileAbsPath, d1, 0644) assert.NoError(t, err, "Couldn't create file") return } @@ -1935,9 +1934,9 @@ func TestArtifactoryUploadExcludeByCli2Wildcard(t *testing.T) { // Create temp files d1 := []byte("test file") - err := ioutil.WriteFile(filepath.Join(absDirPath, "cliTestFile1.in"), d1, 0644) + err := os.WriteFile(filepath.Join(absDirPath, "cliTestFile1.in"), d1, 0644) assert.NoError(t, err, "Couldn't create file") - err = ioutil.WriteFile(filepath.Join(absDirPath, "cliTestFile2.in"), d1, 0644) + err = os.WriteFile(filepath.Join(absDirPath, "cliTestFile2.in"), d1, 0644) assert.NoError(t, err, "Couldn't create file") // Upload files @@ -1962,9 +1961,9 @@ func TestArtifactoryUploadExcludeByCli2Regex(t *testing.T) { // Create temp files d1 := []byte("test file") - err := ioutil.WriteFile(filepath.Join(absDirPath, "cliTestFile1.in"), d1, 0644) + err := os.WriteFile(filepath.Join(absDirPath, "cliTestFile1.in"), d1, 0644) assert.NoError(t, err, "Couldn't create file") - err = ioutil.WriteFile(filepath.Join(absDirPath, "cliTestFile2.in"), d1, 0644) + err = os.WriteFile(filepath.Join(absDirPath, "cliTestFile2.in"), d1, 0644) assert.NoError(t, err, "Couldn't create file") // Upload files @@ -2105,7 +2104,7 @@ func TestValidateBrokenSymlink(t *testing.T) { } initArtifactoryTest(t, "") // Create temporary file in resourcesPath/a/ - tmpFile, err := ioutil.TempFile(tests.GetTestResourcesPath()+"a/", "a.in.") + tmpFile, err := os.CreateTemp(tests.GetTestResourcesPath()+"a/", "a.in.") if assert.NoError(t, err) { assert.NoError(t, tmpFile.Close()) } @@ -4560,7 +4559,7 @@ func execListBuildNamesRest() ([]string, error) { } func execCreateRepoRest(repoConfig, repoName string) { - output, err := ioutil.ReadFile(repoConfig) + output, err := os.ReadFile(repoConfig) if err != nil { log.Error(err) os.Exit(1) diff --git a/build/docker/full/Dockerfile b/build/docker/full/Dockerfile index 0ba01d950..fafa58dfc 100644 --- a/build/docker/full/Dockerfile +++ b/build/docker/full/Dockerfile @@ -1,6 +1,6 @@ ARG repo_name_21 # Remove ${repo_name_21} to pull from Docker Hub. -FROM ${repo_name_21}/jfrog-docker/golang:1.18.5 as builder +FROM ${repo_name_21}/jfrog-docker/golang:1.19.2 as builder ARG image_name=jfrog-cli-full ARG cli_executable_name WORKDIR /${image_name} diff --git a/build/docker/slim/Dockerfile b/build/docker/slim/Dockerfile index 597ad6ef3..19500dda6 100644 --- a/build/docker/slim/Dockerfile +++ b/build/docker/slim/Dockerfile @@ -1,6 +1,6 @@ ARG repo_name_21 # Remove ${repo_name_21} to pull from Docker Hub. -FROM ${repo_name_21}/jfrog-docker/golang:1.18.5-alpine as builder +FROM ${repo_name_21}/jfrog-docker/golang:1.19.2-alpine as builder ARG image_name=jfrog-cli ARG cli_executable_name WORKDIR /${image_name} diff --git a/buildinfo_test.go b/buildinfo_test.go index 34f14d0c0..6d95a8024 100644 --- a/buildinfo_test.go +++ b/buildinfo_test.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" "os" "path/filepath" "strconv" @@ -167,7 +166,7 @@ func TestBuildAddDependenciesDryRun(t *testing.T) { buildDir, err := utils.GetBuildDir(tests.RtBuildName1, "1", "") assert.NoError(t, err) - files, _ := ioutil.ReadDir(buildDir) + files, _ := os.ReadDir(buildDir) assert.Zero(t, len(files), "'rt bad' command with dry-run failed. The dry-run option has no effect.") // Execute the bad command on remote Artifactory @@ -180,7 +179,7 @@ func TestBuildAddDependenciesDryRun(t *testing.T) { buildDir, err = utils.GetBuildDir(tests.RtBuildName1, "2", "") assert.NoError(t, err) - files, _ = ioutil.ReadDir(buildDir) + files, _ = os.ReadDir(buildDir) assert.Zero(t, len(files), "'rt bad' command on remote with dry-run failed. The dry-run option has no effect.") chdirCallback() @@ -283,11 +282,11 @@ func verifyBuildPublishOutput(t *testing.T, buffer *bytes.Buffer, dryRun bool) { } } -func getFilesFromBuildDir(t *testing.T, buildName, buildNumber, projectKey string) []os.FileInfo { +func getFilesFromBuildDir(t *testing.T, buildName, buildNumber, projectKey string) []os.DirEntry { buildDir, err := utils.GetBuildDir(buildName, buildNumber, "") assert.NoError(t, err) - files, err := ioutil.ReadDir(buildDir) + files, err := os.ReadDir(buildDir) assert.NoError(t, err) return files } diff --git a/completion/shells/bash/bash.go b/completion/shells/bash/bash.go index 4d301ba42..b59759d9c 100644 --- a/completion/shells/bash/bash.go +++ b/completion/shells/bash/bash.go @@ -6,7 +6,7 @@ import ( "fmt" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" "github.com/jfrog/jfrog-client-go/utils/log" - "io/ioutil" + "os" "path/filepath" ) @@ -34,7 +34,7 @@ func WriteBashCompletionScript(install bool) { return } completionPath := filepath.Join(homeDir, "jfrog_bash_completion") - if err = ioutil.WriteFile(completionPath, []byte(BashAutocomplete), 0600); err != nil { + if err = os.WriteFile(completionPath, []byte(BashAutocomplete), 0600); err != nil { log.Error(err) return } diff --git a/completion/shells/fish/fish.go b/completion/shells/fish/fish.go index 0ff0294c4..72755107b 100644 --- a/completion/shells/fish/fish.go +++ b/completion/shells/fish/fish.go @@ -2,7 +2,6 @@ package fish import ( "fmt" - "io/ioutil" "os" "path/filepath" @@ -27,7 +26,7 @@ func WriteFishCompletionScript(c *cli.Context, install bool) { return } completionPath := filepath.Join(homeDir, ".config", "fish", "completions", jfApp.Name+".fish") - err = ioutil.WriteFile(completionPath, []byte(fishAutocomplete), 0600) + err = os.WriteFile(completionPath, []byte(fishAutocomplete), 0600) if err != nil { log.Error(err) } diff --git a/completion/shells/generate_scripts_test.go b/completion/shells/generate_scripts_test.go index 529284126..409fd6c14 100644 --- a/completion/shells/generate_scripts_test.go +++ b/completion/shells/generate_scripts_test.go @@ -5,7 +5,7 @@ import ( "github.com/jfrog/jfrog-cli/completion/shells/zsh" clientTestUtils "github.com/jfrog/jfrog-client-go/utils/tests" "github.com/stretchr/testify/assert" - "io/ioutil" + "io" "os" "os/exec" "path/filepath" @@ -43,7 +43,7 @@ func TestGenerateScripts(t *testing.T) { assert.NoError(t, bashFile.Close()) }() assert.NoError(t, err) - b, err := ioutil.ReadAll(bashFile) + b, err := io.ReadAll(bashFile) assert.NoError(t, err) assert.Equal(t, bash.BashAutocomplete, string(b)) @@ -53,7 +53,7 @@ func TestGenerateScripts(t *testing.T) { assert.NoError(t, zshFile.Close()) }() assert.NoError(t, err) - b, err = ioutil.ReadAll(zshFile) + b, err = io.ReadAll(zshFile) assert.NoError(t, err) assert.Equal(t, zsh.ZshAutocomplete, string(b)) } diff --git a/completion/shells/zsh/zsh.go b/completion/shells/zsh/zsh.go index 4514639e4..b4ed231e3 100644 --- a/completion/shells/zsh/zsh.go +++ b/completion/shells/zsh/zsh.go @@ -6,7 +6,7 @@ import ( "fmt" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" "github.com/jfrog/jfrog-client-go/utils/log" - "io/ioutil" + "os" "path/filepath" ) @@ -35,7 +35,7 @@ func WriteZshCompletionScript(install bool) { return } completionPath := filepath.Join(homeDir, "jfrog_zsh_completion") - if err = ioutil.WriteFile(completionPath, []byte(ZshAutocomplete), 0600); err != nil { + if err = os.WriteFile(completionPath, []byte(ZshAutocomplete), 0600); err != nil { log.Error(err) return } diff --git a/distribution/cli.go b/distribution/cli.go index ce3704470..875af521c 100644 --- a/distribution/cli.go +++ b/distribution/cli.go @@ -2,7 +2,7 @@ package distribution import ( "errors" - "io/ioutil" + "os" "path/filepath" "strings" @@ -310,7 +310,7 @@ func createReleaseBundleCreateUpdateParams(c *cli.Context, bundleName, bundleVer releaseBundleParams.GpgPassphrase = c.String("passphrase") releaseBundleParams.Description = c.String("desc") if c.IsSet("release-notes-path") { - bytes, err := ioutil.ReadFile(c.String("release-notes-path")) + bytes, err := os.ReadFile(c.String("release-notes-path")) if err != nil { return releaseBundleParams, errorutils.CheckError(err) } diff --git a/distribution_test.go b/distribution_test.go index 9ea725b11..bf6424c01 100644 --- a/distribution_test.go +++ b/distribution_test.go @@ -16,8 +16,8 @@ import ( "github.com/jfrog/jfrog-client-go/utils/io/httputils" "github.com/jfrog/jfrog-client-go/utils/log" "github.com/stretchr/testify/assert" - "io/ioutil" "net/http" + "os" "path/filepath" "strconv" "testing" @@ -390,7 +390,7 @@ func TestCreateBundleText(t *testing.T) { distributableResponse := inttestutils.GetLocalBundle(t, tests.BundleName, bundleVersion, distHttpDetails) if distributableResponse != nil { assert.Equal(t, description, distributableResponse.Description) - releaseNotes, err := ioutil.ReadFile(releaseNotesPath) + releaseNotes, err := os.ReadFile(releaseNotesPath) assert.NoError(t, err) assert.Equal(t, string(releaseNotes), distributableResponse.ReleaseNotes.Content) assert.Equal(t, clientDistUtils.Markdown, distributableResponse.ReleaseNotes.Syntax) diff --git a/docker_test.go b/docker_test.go index b3c36c54a..d904b6190 100644 --- a/docker_test.go +++ b/docker_test.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" "os" "path" "path/filepath" @@ -191,7 +190,7 @@ func TestPushFatManifestImage(t *testing.T) { assert.NoError(t, err) assert.NoError(t, fileutils.CreateDirIfNotExist(workspace)) testDataDir := filepath.Join(filepath.FromSlash(tests.GetTestResourcesPath()), "docker") - files, err := ioutil.ReadDir(testDataDir) + files, err := os.ReadDir(testDataDir) assert.NoError(t, err) for _, file := range files { @@ -522,7 +521,7 @@ func getExpectedFatManifestBuildInfo(t *testing.T, fileName string) entities.Bui assert.NoError(t, err) buildinfoFile, err = filepath.Abs(buildinfoFile) assert.NoError(t, err) - data, err := ioutil.ReadFile(buildinfoFile) + data, err := os.ReadFile(buildinfoFile) assert.NoError(t, err) var buildinfo entities.BuildInfo assert.NoError(t, json.Unmarshal(data, &buildinfo)) diff --git a/general/cisetup/cisetup.go b/general/cisetup/cisetup.go index 6c6f11d80..f1dfda439 100644 --- a/general/cisetup/cisetup.go +++ b/general/cisetup/cisetup.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/json" "fmt" - "io/ioutil" "os" "path" "path/filepath" @@ -154,7 +153,7 @@ func saveVcsConf(conf *cisetup.CiSetupData) error { if err != nil { return errorutils.CheckError(err) } - err = ioutil.WriteFile(filepath.Join(homeDirPath, VcsConfigFile), content.Bytes(), 0600) + err = os.WriteFile(filepath.Join(homeDirPath, VcsConfigFile), content.Bytes(), 0600) return errorutils.CheckError(err) } @@ -269,7 +268,7 @@ func createPermissionTarget(serverDetails *utilsConfig.ServerDetails) error { return err } pttPath := filepath.Join(tempDir, pttFileName) - err = ioutil.WriteFile(pttPath, []byte(ptTemplate), 0600) + err = os.WriteFile(pttPath, []byte(ptTemplate), 0600) if err != nil { return err } @@ -421,7 +420,7 @@ func (cc *CiSetupCommand) runPipelinesPhase() (string, error) { func (cc *CiSetupCommand) saveCiConfigToFile(ciConfig []byte, fileName string) error { filePath := filepath.Join(cc.data.LocalDirPath, fileName) log.Info(fmt.Sprintf("Generating %s at: %q ...", fileName, filePath)) - return ioutil.WriteFile(filePath, ciConfig, 0644) + return os.WriteFile(filePath, ciConfig, 0644) } func (cc *CiSetupCommand) getPipelinesCompletionInstruction(pipelinesFileName string) ([]string, error) { diff --git a/go.mod b/go.mod index 13bb01086..b10ae2a4d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/jfrog/jfrog-cli -go 1.18 +go 1.19 require ( github.com/agnivade/levenshtein v1.1.1 @@ -121,10 +121,10 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -// replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.1-0.20221031115821-41443331f630 +replace github.com/jfrog/build-info-go => github.com/jfrog/build-info-go v1.8.2-0.20221107114147-4a1ad939c80e -// replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.24.2-0.20221102161532-14cd5ae8d44b +replace github.com/jfrog/jfrog-client-go => github.com/jfrog/jfrog-client-go v1.24.3-0.20221107114801-043ceacadcba -// replace github.com/jfrog/jfrog-cli-core/v2 => /Users/eyalb/dev/forks/jfrog-cli-core +replace github.com/jfrog/jfrog-cli-core/v2 => github.com/jfrog/jfrog-cli-core/v2 v2.24.2-0.20221107121734-f7c7dd672392 -// replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.2.2 +replace github.com/jfrog/gofrog => github.com/jfrog/gofrog v1.2.5-0.20221107113836-a4c9225c690e diff --git a/go.sum b/go.sum index 5f90d9004..cbf31fb5a 100644 --- a/go.sum +++ b/go.sum @@ -527,14 +527,14 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i github.com/jedib0t/go-pretty/v6 v6.3.7 h1:H3Ulkf7h6A+p0HgKBGzgDn0bZIupRbKKWF4pO4Bs7iA= github.com/jedib0t/go-pretty/v6 v6.3.7/go.mod h1:MgmISkTWDSFu0xOqiZ0mKNntMQ2mDgOcwOkwBEkMDJI= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= -github.com/jfrog/build-info-go v1.8.1 h1:HVq3pVMwb88Lidyg6kumDKOag/KpsmhzOHhGYLr43Ec= -github.com/jfrog/build-info-go v1.8.1/go.mod h1:00yoQNP5tiZNdmw+4RtE8ZRJ4CeV0O/BJzkKwLDNQAM= -github.com/jfrog/gofrog v1.2.4 h1:PDk/TFUz6HFvXIdoVI4UFzeoVocMVIu+YkROKHJXCOY= -github.com/jfrog/gofrog v1.2.4/go.mod h1:lbkGXX/DHKdomaSV34eiOC3pAr1HRNa9ffOYh7U7b1U= -github.com/jfrog/jfrog-cli-core/v2 v2.24.1 h1:HBaNu3PQoDazfqEeWpSfRj6lIVe+eJWK41gMzfSUAnQ= -github.com/jfrog/jfrog-cli-core/v2 v2.24.1/go.mod h1:dtcFGR/ep+dBNzwJ9mf2YgI3d9+1sTbdU9HTmLeN4TE= -github.com/jfrog/jfrog-client-go v1.24.2 h1:FjF6TQQs1VVnY/oYkWt3yR4aS0O9aQ37Te+j/QIu2hw= -github.com/jfrog/jfrog-client-go v1.24.2/go.mod h1:cUi4SuJqQ7miwfRi9dnGaWiSGJoi7bVmuxZy+OJfXw4= +github.com/jfrog/build-info-go v1.8.2-0.20221107114147-4a1ad939c80e h1:5V6iyZ5vqP82xJpmM0xFx2DkwobsvyS2XXU1gj+hpxI= +github.com/jfrog/build-info-go v1.8.2-0.20221107114147-4a1ad939c80e/go.mod h1:iSTj26qEX3eUtyAGMH0qKsW4WJT+MceYxLWP9FfiAq4= +github.com/jfrog/gofrog v1.2.5-0.20221107113836-a4c9225c690e h1:T/K5VI7dJl+SYWM7mSrv/buZpjKvCkYWInuMx9Ct/hw= +github.com/jfrog/gofrog v1.2.5-0.20221107113836-a4c9225c690e/go.mod h1:o00tSRff6IapTgaCMuX1Cs9MH08Y1JqnsKgRtx91Gc4= +github.com/jfrog/jfrog-cli-core/v2 v2.24.2-0.20221107121734-f7c7dd672392 h1:AGJbqE1MfRNKaa/3Ip6Zzs7fY8c1cEN3kaG/C2D4UnA= +github.com/jfrog/jfrog-cli-core/v2 v2.24.2-0.20221107121734-f7c7dd672392/go.mod h1:0Kg9mPb6Z+OFzwY4ucdE+Qs5OVhbrOPwWqVrW3jME5g= +github.com/jfrog/jfrog-client-go v1.24.3-0.20221107114801-043ceacadcba h1:1sXtyGboWm6FNm3cAEtwIehizNeE0d7DMn7vxL+R4hc= +github.com/jfrog/jfrog-client-go v1.24.3-0.20221107114801-043ceacadcba/go.mod h1:Z1jMsU/ouPkxxDT1JeCfODjE4kBnMsHQ4BLc3NazVx0= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= diff --git a/inttestutils/distribution.go b/inttestutils/distribution.go index c02c8a417..8e13aab6b 100644 --- a/inttestutils/distribution.go +++ b/inttestutils/distribution.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "github.com/jfrog/jfrog-client-go/utils/errorutils" - "io/ioutil" "net/http" "os" "path/filepath" @@ -73,9 +72,9 @@ type ReceivedResponses struct { func SendGpgKeys(artHttpDetails httputils.HttpClientDetails, distHttpDetails httputils.HttpClientDetails) { // Read gpg public and private keys keysDir := filepath.Join(tests.GetTestResourcesPath(), "distribution") - publicKey, err := ioutil.ReadFile(filepath.Join(keysDir, "public.key.1")) + publicKey, err := os.ReadFile(filepath.Join(keysDir, "public.key.1")) coreutils.ExitOnErr(err) - privateKey, err := ioutil.ReadFile(filepath.Join(keysDir, "private.key")) + privateKey, err := os.ReadFile(filepath.Join(keysDir, "private.key")) coreutils.ExitOnErr(err) // Create http client diff --git a/maven_test.go b/maven_test.go index 04af127c9..97b78cb45 100644 --- a/maven_test.go +++ b/maven_test.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "io/ioutil" "os" "path/filepath" "strings" @@ -171,7 +170,7 @@ func createHomeConfigAndLocalRepo(t *testing.T, encryptPassword bool) (err error createJfrogHomeConfig(t, encryptPassword) // To make sure we download the dependencies from Artifactory, we will run with customize .m2 directory. // The directory wil be deleted on the test cleanup as part as the out dir. - localRepoDir, err = ioutil.TempDir(os.Getenv(coreutils.HomeDir), "tmp.m2") + localRepoDir, err = os.MkdirTemp(os.Getenv(coreutils.HomeDir), "tmp.m2") return err } diff --git a/nuget_test.go b/nuget_test.go index 50368944f..49b51a55e 100644 --- a/nuget_test.go +++ b/nuget_test.go @@ -15,7 +15,6 @@ import ( clientTestUtils "github.com/jfrog/jfrog-client-go/utils/tests" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "io/ioutil" "os" "path/filepath" "strconv" @@ -229,7 +228,7 @@ func runInitNewConfig(t *testing.T, testSuite testInitNewConfigDescriptor, baseR return } - content, err := ioutil.ReadFile(configFile.Name()) + content, err := os.ReadFile(configFile.Name()) if err != nil { assert.NoError(t, err) return diff --git a/schema/filespecschema_test.go b/schema/filespecschema_test.go index 5fb204102..8aad57e6a 100644 --- a/schema/filespecschema_test.go +++ b/schema/filespecschema_test.go @@ -1,7 +1,6 @@ package schema import ( - "io/ioutil" "os" "path/filepath" "testing" @@ -12,7 +11,7 @@ import ( func TestFileSpecSchema(t *testing.T) { // Load File Spec schema - schema, err := ioutil.ReadFile("filespec-schema.json") + schema, err := os.ReadFile("filespec-schema.json") assert.NoError(t, err) schemaLoader := gojsonschema.NewBytesLoader(schema) @@ -24,7 +23,7 @@ func TestFileSpecSchema(t *testing.T) { return nil } - specFileContent, err := ioutil.ReadFile(path) + specFileContent, err := os.ReadFile(path) assert.NoError(t, err) documentLoader := gojsonschema.NewBytesLoader(specFileContent) result, err := gojsonschema.Validate(schemaLoader, documentLoader) diff --git a/utils/progressbar/readerprogressbar.go b/utils/progressbar/readerprogressbar.go index 0302d3549..27c44260c 100644 --- a/utils/progressbar/readerprogressbar.go +++ b/utils/progressbar/readerprogressbar.go @@ -2,7 +2,6 @@ package progressbar import ( "io" - "io/ioutil" ) type ReaderProgressBar struct { @@ -48,7 +47,7 @@ func initProxyReader(unit *progressBarUnit, reader io.Reader) io.ReadCloser { } rc, ok := reader.(io.ReadCloser) if !ok { - rc = ioutil.NopCloser(reader) + rc = io.NopCloser(reader) } return &proxyReader{unit, rc} } diff --git a/utils/tests/container.go b/utils/tests/container.go index 78223cb8b..7894cea76 100644 --- a/utils/tests/container.go +++ b/utils/tests/container.go @@ -3,19 +3,20 @@ package tests import ( "context" "fmt" - "io/ioutil" + "io" "testing" "github.com/jfrog/jfrog-client-go/utils/log" "github.com/testcontainers/testcontainers-go" "github.com/testcontainers/testcontainers-go/wait" ) + // When two containers are joined to the same network, one container is able to address another by using its name (as the hostname). // Docker tests use this to spin up a new builder container and push the result to a local Artifactory using hostname instead of IP address. const RtContainerHostName = "artifactory:8082" -// TestContainer is a friendly API to run container. -// It is designed to create runtime environment to use during automatic tests. +// TestContainer is a friendly API to run container. +// It is designed to create runtime environment to use during automatic tests. type TestContainer struct { container testcontainers.Container } @@ -26,7 +27,7 @@ func (tc *TestContainer) Exec(ctx context.Context, cmd ...string) error { if err != nil { return err } - data, err := ioutil.ReadAll(reader) + data, err := io.ReadAll(reader) if err != nil { return err } @@ -108,7 +109,7 @@ func (c *ContainerRequest) Mount(hostPath, target string, readOnly bool) *Contai return c } -// When the container starts, set command instructions (shell for example). +// When the container starts, set command instructions (shell for example). func (c *ContainerRequest) Cmd(cmd ...string) *ContainerRequest { c.request.Cmd = cmd return c @@ -135,7 +136,7 @@ func (c *ContainerRequest) Build(ctx context.Context, t *testing.T, autoStart bo if err != nil { return nil, err } - data, err := ioutil.ReadAll(reader) + data, err := io.ReadAll(reader) if err != nil { return nil, err } diff --git a/utils/tests/utils.go b/utils/tests/utils.go index 455d3226f..d267bb338 100644 --- a/utils/tests/utils.go +++ b/utils/tests/utils.go @@ -7,7 +7,7 @@ import ( "errors" "flag" "fmt" - "io/ioutil" + "io" "math/rand" "os" "path/filepath" @@ -266,7 +266,7 @@ func (cli *JfrogCli) RunCliCmdWithOutput(t *testing.T, args ...string) string { // Closing the temp stdout in order to be able to read it's content. assert.NoError(t, stdWriter.Close()) }() - content, err := ioutil.ReadAll(newStdout) + content, err := io.ReadAll(newStdout) assert.NoError(t, err) // Prints the redirected output to the standard output as well. _, err = previousStdout.Write(content) @@ -589,7 +589,7 @@ func AddTimestampToGlobalVars() { } func ReplaceTemplateVariables(path, destPath string) (string, error) { - content, err := ioutil.ReadFile(path) + content, err := os.ReadFile(path) if err != nil { return "", errorutils.CheckError(err) } @@ -610,7 +610,7 @@ func ReplaceTemplateVariables(path, destPath string) (string, error) { } specPath := filepath.Join(destPath, filepath.Base(path)) log.Info("Creating spec file at:", specPath) - err = ioutil.WriteFile(specPath, []byte(content), 0700) + err = os.WriteFile(specPath, []byte(content), 0700) if err != nil { return "", errorutils.CheckError(err) } @@ -705,8 +705,8 @@ func RedirectStdOutToPipe() (reader *os.File, writer *os.File, previousStdout *o func RedirectLogOutputToNil() (previousLog log.Log) { previousLog = log.Logger newLog := log.NewLogger(corelog.GetCliLogLevel(), nil) - newLog.SetOutputWriter(ioutil.Discard) - newLog.SetLogsWriter(ioutil.Discard, 0) + newLog.SetOutputWriter(io.Discard) + newLog.SetLogsWriter(io.Discard, 0) log.SetLogger(newLog) return previousLog } @@ -737,7 +737,7 @@ func GetCmdOutput(t *testing.T, jfrogCli *JfrogCli, cmd ...string) ([]byte, erro }() err = jfrogCli.Exec(cmd...) assert.NoError(t, err) - content, err := ioutil.ReadFile(temp.Name()) + content, err := os.ReadFile(temp.Name()) assert.NoError(t, err) return content, err }