Skip to content

Commit f1f6d3b

Browse files
authored
Upgrade to GO 1.19 (#1747)
1 parent c7d4761 commit f1f6d3b

40 files changed

+85
-95
lines changed

Diff for: .github/workflows/accessTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install Go
2222
uses: actions/setup-go@v3
2323
with:
24-
go-version: 1.18.x
24+
go-version: 1.19.x
2525
- name: Go Cache
2626
uses: actions/cache@v3
2727
with:

Diff for: .github/workflows/analysis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Install Go
1616
uses: actions/setup-go@v3
1717
with:
18-
go-version: 1.18.x
18+
go-version: 1.19.x
1919
- name: Checkout code
2020
uses: actions/checkout@v3
2121
with:
@@ -37,7 +37,7 @@ jobs:
3737
- name: Install Go
3838
uses: actions/setup-go@v3
3939
with:
40-
go-version: 1.18.x
40+
go-version: 1.19.x
4141
- name: Static Code Analysis
4242
uses: dominikh/staticcheck-action@v1
4343
with:
@@ -51,7 +51,7 @@ jobs:
5151
- name: Install Go
5252
uses: actions/setup-go@v3
5353
with:
54-
go-version: 1.18.x
54+
go-version: 1.19.x
5555
- name: Install gosec
5656
run: curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
5757
- name: Run gosec

Diff for: .github/workflows/artifactoryTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install Go
2323
uses: actions/setup-go@v3
2424
with:
25-
go-version: 1.18.x
25+
go-version: 1.19.x
2626
- name: Checkout code
2727
uses: actions/checkout@v3
2828
with:

Diff for: .github/workflows/distributionTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install Go
2222
uses: actions/setup-go@v3
2323
with:
24-
go-version: 1.18.x
24+
go-version: 1.19.x
2525
- name: Go Cache
2626
uses: actions/cache@v3
2727
with:

Diff for: .github/workflows/dockerTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Install Go
1818
uses: actions/setup-go@v3
1919
with:
20-
go-version: 1.18.x
20+
go-version: 1.19.x
2121
- name: Checkout code
2222
uses: actions/checkout@v3
2323
with:

Diff for: .github/workflows/frogbot-scan-and-fix.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Go
2020
uses: actions/setup-go@v3
2121
with:
22-
go-version: 1.18.x
22+
go-version: 1.19.x
2323

2424
- uses: jfrog/frogbot@v2
2525
env:

Diff for: .github/workflows/frogbot-scan-pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup Go
2121
uses: actions/setup-go@v3
2222
with:
23-
go-version: 1.18.x
23+
go-version: 1.19.x
2424

2525
- uses: jfrog/frogbot@v2
2626
env:

Diff for: .github/workflows/goTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install Go
2323
uses: actions/setup-go@v3
2424
with:
25-
go-version: 1.18.x
25+
go-version: 1.19.x
2626
- name: Checkout code
2727
uses: actions/checkout@v3
2828
with:

Diff for: .github/workflows/gradleTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install Go
2424
uses: actions/setup-go@v3
2525
with:
26-
go-version: 1.18.x
26+
go-version: 1.19.x
2727
- name: Checkout code
2828
uses: actions/checkout@v3
2929
with:

Diff for: .github/workflows/mavenTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install Go
2222
uses: actions/setup-go@v3
2323
with:
24-
go-version: 1.18.x
24+
go-version: 1.19.x
2525
- name: Checkout code
2626
uses: actions/checkout@v3
2727
with:

Diff for: .github/workflows/npmTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install Go
2222
uses: actions/setup-go@v3
2323
with:
24-
go-version: 1.18.x
24+
go-version: 1.19.x
2525
- name: Install npm
2626
uses: actions/setup-node@v3
2727
with:

Diff for: .github/workflows/nugetTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install Go
2222
uses: actions/setup-go@v3
2323
with:
24-
go-version: 1.18.x
24+
go-version: 1.19.x
2525
- name: Install NuGet
2626
uses: nuget/setup-nuget@v1
2727
with:

Diff for: .github/workflows/pluginsTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install Go
2222
uses: actions/setup-go@v3
2323
with:
24-
go-version: 1.18.x
24+
go-version: 1.19.x
2525
- name: Checkout code
2626
uses: actions/checkout@v3
2727
with:

Diff for: .github/workflows/pythonTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install Go
2323
uses: actions/setup-go@v3
2424
with:
25-
go-version: 1.18.x
25+
go-version: 1.19.x
2626
- name: Setup Python3
2727
uses: actions/setup-python@v4
2828
with:

Diff for: .github/workflows/transferTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Install Go
2626
uses: actions/setup-go@v3
2727
with:
28-
go-version: 1.18.x
28+
go-version: 1.19.x
2929
- name: Go Cache
3030
uses: actions/cache@v3
3131
with:

Diff for: .github/workflows/xrayTests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install Go
2424
uses: actions/setup-go@v3
2525
with:
26-
go-version: 1.18.x
26+
go-version: 1.19.x
2727
- name: Install npm
2828
uses: actions/setup-node@v3
2929
with:

Diff for: Jenkinsfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ node("docker") {
2525
repo = 'jfrog-cli'
2626
sh 'rm -rf temp'
2727
sh 'mkdir temp'
28-
def goRoot = tool 'go-1.18.5'
28+
def goRoot = tool 'go-1.19.2'
2929
env.GOROOT="$goRoot"
3030
env.PATH+=":${goRoot}/bin"
3131
env.GO111MODULE="on"

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
[![Go Report Card](https://goreportcard.com/badge/github.com/jfrog/jfrog-cli)](https://goreportcard.com/report/github.com/jfrog/jfrog-cli)
88
[![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)
9-
9+
[![Go version](https://img.shields.io/github/go-mod/go-version/jfrog/jfrog-cli)](https://tip.golang.org/doc/go1.19)
1010
</div>
1111

1212
<details>

Diff for: artifactory/cli.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package artifactory
33
import (
44
"errors"
55
"fmt"
6-
"io/ioutil"
76
"os"
87
"strconv"
98
"strings"
@@ -2189,7 +2188,7 @@ func usersDeleteCmd(c *cli.Context) error {
21892188

21902189
func parseCSVToUsersList(csvFilePath string) ([]services.User, error) {
21912190
var usersList []services.User
2192-
csvInput, err := ioutil.ReadFile(csvFilePath)
2191+
csvInput, err := os.ReadFile(csvFilePath)
21932192
if err != nil {
21942193
return usersList, errorutils.CheckError(err)
21952194
}

Diff for: artifactory_test.go

+7-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"errors"
99
"fmt"
1010
"io"
11-
"io/ioutil"
1211
"net"
1312
"net/http"
1413
"net/url"
@@ -1900,7 +1899,7 @@ func createFileInHomeDir(t *testing.T, fileName string) (testFileRelPath string,
19001899
testFileRelPath = filepath.Join("~", fileName)
19011900
testFileAbsPath = filepath.Join(fileutils.GetHomeDir(), fileName)
19021901
d1 := []byte("test file")
1903-
err := ioutil.WriteFile(testFileAbsPath, d1, 0644)
1902+
err := os.WriteFile(testFileAbsPath, d1, 0644)
19041903
assert.NoError(t, err, "Couldn't create file")
19051904
return
19061905
}
@@ -1935,9 +1934,9 @@ func TestArtifactoryUploadExcludeByCli2Wildcard(t *testing.T) {
19351934

19361935
// Create temp files
19371936
d1 := []byte("test file")
1938-
err := ioutil.WriteFile(filepath.Join(absDirPath, "cliTestFile1.in"), d1, 0644)
1937+
err := os.WriteFile(filepath.Join(absDirPath, "cliTestFile1.in"), d1, 0644)
19391938
assert.NoError(t, err, "Couldn't create file")
1940-
err = ioutil.WriteFile(filepath.Join(absDirPath, "cliTestFile2.in"), d1, 0644)
1939+
err = os.WriteFile(filepath.Join(absDirPath, "cliTestFile2.in"), d1, 0644)
19411940
assert.NoError(t, err, "Couldn't create file")
19421941

19431942
// Upload files
@@ -1962,9 +1961,9 @@ func TestArtifactoryUploadExcludeByCli2Regex(t *testing.T) {
19621961

19631962
// Create temp files
19641963
d1 := []byte("test file")
1965-
err := ioutil.WriteFile(filepath.Join(absDirPath, "cliTestFile1.in"), d1, 0644)
1964+
err := os.WriteFile(filepath.Join(absDirPath, "cliTestFile1.in"), d1, 0644)
19661965
assert.NoError(t, err, "Couldn't create file")
1967-
err = ioutil.WriteFile(filepath.Join(absDirPath, "cliTestFile2.in"), d1, 0644)
1966+
err = os.WriteFile(filepath.Join(absDirPath, "cliTestFile2.in"), d1, 0644)
19681967
assert.NoError(t, err, "Couldn't create file")
19691968

19701969
// Upload files
@@ -2105,7 +2104,7 @@ func TestValidateBrokenSymlink(t *testing.T) {
21052104
}
21062105
initArtifactoryTest(t, "")
21072106
// Create temporary file in resourcesPath/a/
2108-
tmpFile, err := ioutil.TempFile(tests.GetTestResourcesPath()+"a/", "a.in.")
2107+
tmpFile, err := os.CreateTemp(tests.GetTestResourcesPath()+"a/", "a.in.")
21092108
if assert.NoError(t, err) {
21102109
assert.NoError(t, tmpFile.Close())
21112110
}
@@ -4560,7 +4559,7 @@ func execListBuildNamesRest() ([]string, error) {
45604559
}
45614560

45624561
func execCreateRepoRest(repoConfig, repoName string) {
4563-
output, err := ioutil.ReadFile(repoConfig)
4562+
output, err := os.ReadFile(repoConfig)
45644563
if err != nil {
45654564
log.Error(err)
45664565
os.Exit(1)

Diff for: build/docker/full/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG repo_name_21
22
# Remove ${repo_name_21} to pull from Docker Hub.
3-
FROM ${repo_name_21}/jfrog-docker/golang:1.18.5 as builder
3+
FROM ${repo_name_21}/jfrog-docker/golang:1.19.2 as builder
44
ARG image_name=jfrog-cli-full
55
ARG cli_executable_name
66
WORKDIR /${image_name}

Diff for: build/docker/slim/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG repo_name_21
22
# Remove ${repo_name_21} to pull from Docker Hub.
3-
FROM ${repo_name_21}/jfrog-docker/golang:1.18.5-alpine as builder
3+
FROM ${repo_name_21}/jfrog-docker/golang:1.19.2-alpine as builder
44
ARG image_name=jfrog-cli
55
ARG cli_executable_name
66
WORKDIR /${image_name}

Diff for: buildinfo_test.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"encoding/json"
66
"fmt"
7-
"io/ioutil"
87
"os"
98
"path/filepath"
109
"strconv"
@@ -167,7 +166,7 @@ func TestBuildAddDependenciesDryRun(t *testing.T) {
167166
buildDir, err := utils.GetBuildDir(tests.RtBuildName1, "1", "")
168167
assert.NoError(t, err)
169168

170-
files, _ := ioutil.ReadDir(buildDir)
169+
files, _ := os.ReadDir(buildDir)
171170
assert.Zero(t, len(files), "'rt bad' command with dry-run failed. The dry-run option has no effect.")
172171

173172
// Execute the bad command on remote Artifactory
@@ -180,7 +179,7 @@ func TestBuildAddDependenciesDryRun(t *testing.T) {
180179
buildDir, err = utils.GetBuildDir(tests.RtBuildName1, "2", "")
181180
assert.NoError(t, err)
182181

183-
files, _ = ioutil.ReadDir(buildDir)
182+
files, _ = os.ReadDir(buildDir)
184183
assert.Zero(t, len(files), "'rt bad' command on remote with dry-run failed. The dry-run option has no effect.")
185184

186185
chdirCallback()
@@ -283,11 +282,11 @@ func verifyBuildPublishOutput(t *testing.T, buffer *bytes.Buffer, dryRun bool) {
283282
}
284283
}
285284

286-
func getFilesFromBuildDir(t *testing.T, buildName, buildNumber, projectKey string) []os.FileInfo {
285+
func getFilesFromBuildDir(t *testing.T, buildName, buildNumber, projectKey string) []os.DirEntry {
287286
buildDir, err := utils.GetBuildDir(buildName, buildNumber, "")
288287
assert.NoError(t, err)
289288

290-
files, err := ioutil.ReadDir(buildDir)
289+
files, err := os.ReadDir(buildDir)
291290
assert.NoError(t, err)
292291
return files
293292
}

Diff for: completion/shells/bash/bash.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"fmt"
77
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
88
"github.com/jfrog/jfrog-client-go/utils/log"
9-
"io/ioutil"
9+
"os"
1010
"path/filepath"
1111
)
1212

@@ -34,7 +34,7 @@ func WriteBashCompletionScript(install bool) {
3434
return
3535
}
3636
completionPath := filepath.Join(homeDir, "jfrog_bash_completion")
37-
if err = ioutil.WriteFile(completionPath, []byte(BashAutocomplete), 0600); err != nil {
37+
if err = os.WriteFile(completionPath, []byte(BashAutocomplete), 0600); err != nil {
3838
log.Error(err)
3939
return
4040
}

Diff for: completion/shells/fish/fish.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package fish
22

33
import (
44
"fmt"
5-
"io/ioutil"
65
"os"
76
"path/filepath"
87

@@ -27,7 +26,7 @@ func WriteFishCompletionScript(c *cli.Context, install bool) {
2726
return
2827
}
2928
completionPath := filepath.Join(homeDir, ".config", "fish", "completions", jfApp.Name+".fish")
30-
err = ioutil.WriteFile(completionPath, []byte(fishAutocomplete), 0600)
29+
err = os.WriteFile(completionPath, []byte(fishAutocomplete), 0600)
3130
if err != nil {
3231
log.Error(err)
3332
}

Diff for: completion/shells/generate_scripts_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/jfrog/jfrog-cli/completion/shells/zsh"
66
clientTestUtils "github.com/jfrog/jfrog-client-go/utils/tests"
77
"github.com/stretchr/testify/assert"
8-
"io/ioutil"
8+
"io"
99
"os"
1010
"os/exec"
1111
"path/filepath"
@@ -43,7 +43,7 @@ func TestGenerateScripts(t *testing.T) {
4343
assert.NoError(t, bashFile.Close())
4444
}()
4545
assert.NoError(t, err)
46-
b, err := ioutil.ReadAll(bashFile)
46+
b, err := io.ReadAll(bashFile)
4747
assert.NoError(t, err)
4848
assert.Equal(t, bash.BashAutocomplete, string(b))
4949

@@ -53,7 +53,7 @@ func TestGenerateScripts(t *testing.T) {
5353
assert.NoError(t, zshFile.Close())
5454
}()
5555
assert.NoError(t, err)
56-
b, err = ioutil.ReadAll(zshFile)
56+
b, err = io.ReadAll(zshFile)
5757
assert.NoError(t, err)
5858
assert.Equal(t, zsh.ZshAutocomplete, string(b))
5959
}

Diff for: completion/shells/zsh/zsh.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"fmt"
77
"github.com/jfrog/jfrog-cli-core/v2/utils/coreutils"
88
"github.com/jfrog/jfrog-client-go/utils/log"
9-
"io/ioutil"
9+
"os"
1010
"path/filepath"
1111
)
1212

@@ -35,7 +35,7 @@ func WriteZshCompletionScript(install bool) {
3535
return
3636
}
3737
completionPath := filepath.Join(homeDir, "jfrog_zsh_completion")
38-
if err = ioutil.WriteFile(completionPath, []byte(ZshAutocomplete), 0600); err != nil {
38+
if err = os.WriteFile(completionPath, []byte(ZshAutocomplete), 0600); err != nil {
3939
log.Error(err)
4040
return
4141
}

0 commit comments

Comments
 (0)