Skip to content

Commit

Permalink
Update golang version to 10.19.2 (#1925)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakulkar-msft committed Dec 6, 2022
1 parent 9d57431 commit d7c9d3a
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
env:
GO111MODULE: 'on'
inputs:
version: '1.17.9'
version: '1.19.2'

- script: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.43.0
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.46.2
echo 'Installation complete'
./bin/golangci-lint --version
./bin/golangci-lint run e2etest
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
steps:
- task: GoTool@0
inputs:
version: '1.17.9'
version: '1.19.2'

# Running E2E Tests on Linux - AMD64
- script: |
Expand Down Expand Up @@ -204,7 +204,7 @@ jobs:
- task: GoTool@0
name: 'Set_up_Golang'
inputs:
version: '1.17.9'
version: '1.19.2'
- task: DownloadSecureFile@1
name: ciGCSServiceAccountKey
displayName: 'Download GCS Service Account Key'
Expand Down
6 changes: 3 additions & 3 deletions e2etest/arm.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"fmt"
"github.com/Azure/go-autorest/autorest/adal"
"io/ioutil"
"io"
"net/http"
"reflect"
"strconv"
Expand Down Expand Up @@ -53,7 +53,7 @@ func ResolveAzureAsyncOperation(OAuth *adal.ServicePrincipalToken, uri string, p
}

var buf []byte
buf, err = ioutil.ReadAll(resp.Body)
buf, err = io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("failed to read response body (resp code 200): %w", err)
}
Expand All @@ -68,7 +68,7 @@ func ResolveAzureAsyncOperation(OAuth *adal.ServicePrincipalToken, uri string, p
}

if resp.StatusCode != 200 {
rBody, err := ioutil.ReadAll(resp.Body)
rBody, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("failed to read response body (resp code %d): %w", resp.StatusCode, err)
}
Expand Down
4 changes: 2 additions & 2 deletions e2etest/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ package e2etest
import (
"context"
"fmt"
"io/ioutil"
"net/url"
"os"
"path"
"runtime"
"strings"
Expand Down Expand Up @@ -184,7 +184,7 @@ func (TestResourceFactory) CreateNewFileShareSnapshot(c asserter, fileShare azfi
}

func (TestResourceFactory) CreateLocalDirectory(c asserter) (dstDirName string) {
dstDirName, err := ioutil.TempDir("", "AzCopyLocalTest")
dstDirName, err := os.MkdirTemp("","AzCopyLocalTest")
c.AssertNoErr(err)
return
}
Expand Down
8 changes: 4 additions & 4 deletions e2etest/managedDisks.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"path"
Expand Down Expand Up @@ -77,15 +77,15 @@ func (config *ManagedDiskConfig) GetAccess() (*url.URL, error) {
return nil, fmt.Errorf("failed to get access (async op): %w", err)
}
} else { // error
rBody, err := ioutil.ReadAll(resp.Body)
rBody, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("failed to read response body (resp code %d): %w", resp.StatusCode, err)
}

return nil, fmt.Errorf("failed to get access (resp code %d): %s", resp.StatusCode, string(rBody))
}
} else { // immediate response
rBody, err := ioutil.ReadAll(resp.Body)
rBody, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("failed to read response body: %w", err)
}
Expand Down Expand Up @@ -132,7 +132,7 @@ func (config *ManagedDiskConfig) RevokeAccess() error {
return err
}

rBody, err := ioutil.ReadAll(resp.Body)
rBody, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("failed to read response body (resp code %d): %w", resp.StatusCode, err)
}
Expand Down
14 changes: 7 additions & 7 deletions e2etest/scenario_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"context"
"crypto/md5"
"fmt"
"io/ioutil"
"io"
"net/url"
"os"
"path"
Expand Down Expand Up @@ -67,7 +67,7 @@ var specialNames = []string{
// note: this is to emulate the list-of-files flag
// nolint
func (scenarioHelper) generateListOfFiles(c asserter, fileList []string) (path string) {
parentDirName, err := ioutil.TempDir("", "AzCopyLocalTest")
parentDirName, err := os.MkdirTemp("", "AzCopyLocalTest")
c.AssertNoErr(err)

// create the file
Expand All @@ -77,14 +77,14 @@ func (scenarioHelper) generateListOfFiles(c asserter, fileList []string) (path s

// pipe content into it
content := strings.Join(fileList, "\n")
err = ioutil.WriteFile(path, []byte(content), common.DEFAULT_FILE_PERM)
err = os.WriteFile(path, []byte(content), common.DEFAULT_FILE_PERM)
c.AssertNoErr(err)
return
}

// nolint
func (scenarioHelper) generateLocalDirectory(c asserter) (dstDirName string) {
dstDirName, err := ioutil.TempDir("", "AzCopyLocalTest")
dstDirName, err := os.MkdirTemp("", "AzCopyLocalTest")
c.AssertNoErr(err)
return
}
Expand All @@ -101,7 +101,7 @@ func (scenarioHelper) generateLocalFile(filePath string, fileSize int) ([]byte,
}

// write to file and return the data
err = ioutil.WriteFile(filePath, bigBuff, common.DEFAULT_FILE_PERM)
err = os.WriteFile(filePath, bigBuff, common.DEFAULT_FILE_PERM)
return bigBuff, err
}

Expand Down Expand Up @@ -529,7 +529,7 @@ func (s scenarioHelper) downloadBlobContent(a asserter, options downloadContentO
retryReader := downloadResp.Body(azblob.RetryReaderOptions{})
defer retryReader.Close()

destData, err := ioutil.ReadAll(retryReader)
destData, err := io.ReadAll(retryReader)
a.AssertNoErr(err)
return destData[:]
}
Expand Down Expand Up @@ -910,7 +910,7 @@ func (s scenarioHelper) downloadFileContent(a asserter, options downloadContentO
retryReader := downloadResp.Body(azfile.RetryReaderOptions{})
defer retryReader.Close() // The client must close the response body when finished with it

destData, err := ioutil.ReadAll(retryReader)
destData, err := io.ReadAll(retryReader)
a.AssertNoErr(err)
downloadResp.Body(azfile.RetryReaderOptions{})
return destData
Expand Down
4 changes: 2 additions & 2 deletions e2etest/scenario_os_helpers_for_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
type osScenarioHelper struct{}

// set file attributes to test file
func (osScenarioHelper) setAttributesForLocalFile(filePath string, attrList []string) error {
func (osScenarioHelper) setAttributesForLocalFile(filePath string, attrList []string) error { //nolint:golint,unused
lpFilePath, err := syscall.UTF16PtrFromString(filePath)
if err != nil {
return err
Expand All @@ -65,7 +65,7 @@ func (osScenarioHelper) setAttributesForLocalFile(filePath string, attrList []st
return err
}

func (s osScenarioHelper) setAttributesForLocalFiles(c asserter, dirPath string, fileList []string, attrList []string) {
func (s osScenarioHelper) setAttributesForLocalFiles(c asserter, dirPath string, fileList []string, attrList []string) { //nolint:golint,unused
for _, fileName := range fileList {
err := s.setAttributesForLocalFile(filepath.Join(dirPath, fileName), attrList)
c.AssertNoErr(err)
Expand Down

0 comments on commit d7c9d3a

Please sign in to comment.