Skip to content

Commit

Permalink
Upgrade to GO 1.19 (#1747)
Browse files Browse the repository at this point in the history
  • Loading branch information
gailazar300 authored Nov 7, 2022
1 parent c7d4761 commit f1f6d3b
Show file tree
Hide file tree
Showing 40 changed files with 85 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/accessTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/artifactoryTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/distributionTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dockerTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frogbot-scan-and-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frogbot-scan-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/goTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradleTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mavenTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npmTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nugetTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pluginsTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythonTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/transferTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/xrayTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
</div>

<details>
Expand Down
3 changes: 1 addition & 2 deletions artifactory/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package artifactory
import (
"errors"
"fmt"
"io/ioutil"
"os"
"strconv"
"strings"
Expand Down Expand Up @@ -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)
}
Expand Down
15 changes: 7 additions & 8 deletions artifactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
"net/url"
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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())
}
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion build/docker/full/Dockerfile
Original file line number Diff line number Diff line change
@@ -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}
Expand Down
2 changes: 1 addition & 1 deletion build/docker/slim/Dockerfile
Original file line number Diff line number Diff line change
@@ -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}
Expand Down
9 changes: 4 additions & 5 deletions buildinfo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strconv"
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions completion/shells/bash/bash.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
}
Expand Down
3 changes: 1 addition & 2 deletions completion/shells/fish/fish.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package fish

import (
"fmt"
"io/ioutil"
"os"
"path/filepath"

Expand All @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions completion/shells/generate_scripts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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))

Expand All @@ -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))
}
4 changes: 2 additions & 2 deletions completion/shells/zsh/zsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

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

0 comments on commit f1f6d3b

Please sign in to comment.