Skip to content

Commit d7c9d3a

Browse files
Update golang version to 10.19.2 (#1925)
1 parent 9d57431 commit d7c9d3a

6 files changed

+22
-22
lines changed

azure-pipelines.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929
env:
3030
GO111MODULE: 'on'
3131
inputs:
32-
version: '1.17.9'
32+
version: '1.19.2'
3333

3434
- script: |
35-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.43.0
35+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.46.2
3636
echo 'Installation complete'
3737
./bin/golangci-lint --version
3838
./bin/golangci-lint run e2etest
@@ -116,7 +116,7 @@ jobs:
116116
steps:
117117
- task: GoTool@0
118118
inputs:
119-
version: '1.17.9'
119+
version: '1.19.2'
120120

121121
# Running E2E Tests on Linux - AMD64
122122
- script: |
@@ -204,7 +204,7 @@ jobs:
204204
- task: GoTool@0
205205
name: 'Set_up_Golang'
206206
inputs:
207-
version: '1.17.9'
207+
version: '1.19.2'
208208
- task: DownloadSecureFile@1
209209
name: ciGCSServiceAccountKey
210210
displayName: 'Download GCS Service Account Key'

e2etest/arm.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"encoding/json"
55
"fmt"
66
"github.com/Azure/go-autorest/autorest/adal"
7-
"io/ioutil"
7+
"io"
88
"net/http"
99
"reflect"
1010
"strconv"
@@ -53,7 +53,7 @@ func ResolveAzureAsyncOperation(OAuth *adal.ServicePrincipalToken, uri string, p
5353
}
5454

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

7070
if resp.StatusCode != 200 {
71-
rBody, err := ioutil.ReadAll(resp.Body)
71+
rBody, err := io.ReadAll(resp.Body)
7272
if err != nil {
7373
return nil, fmt.Errorf("failed to read response body (resp code %d): %w", resp.StatusCode, err)
7474
}

e2etest/factory.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ package e2etest
2323
import (
2424
"context"
2525
"fmt"
26-
"io/ioutil"
2726
"net/url"
27+
"os"
2828
"path"
2929
"runtime"
3030
"strings"
@@ -184,7 +184,7 @@ func (TestResourceFactory) CreateNewFileShareSnapshot(c asserter, fileShare azfi
184184
}
185185

186186
func (TestResourceFactory) CreateLocalDirectory(c asserter) (dstDirName string) {
187-
dstDirName, err := ioutil.TempDir("", "AzCopyLocalTest")
187+
dstDirName, err := os.MkdirTemp("","AzCopyLocalTest")
188188
c.AssertNoErr(err)
189189
return
190190
}

e2etest/managedDisks.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"bytes"
55
"encoding/json"
66
"fmt"
7-
"io/ioutil"
7+
"io"
88
"net/http"
99
"net/url"
1010
"path"
@@ -77,15 +77,15 @@ func (config *ManagedDiskConfig) GetAccess() (*url.URL, error) {
7777
return nil, fmt.Errorf("failed to get access (async op): %w", err)
7878
}
7979
} else { // error
80-
rBody, err := ioutil.ReadAll(resp.Body)
80+
rBody, err := io.ReadAll(resp.Body)
8181
if err != nil {
8282
return nil, fmt.Errorf("failed to read response body (resp code %d): %w", resp.StatusCode, err)
8383
}
8484

8585
return nil, fmt.Errorf("failed to get access (resp code %d): %s", resp.StatusCode, string(rBody))
8686
}
8787
} else { // immediate response
88-
rBody, err := ioutil.ReadAll(resp.Body)
88+
rBody, err := io.ReadAll(resp.Body)
8989
if err != nil {
9090
return nil, fmt.Errorf("failed to read response body: %w", err)
9191
}
@@ -132,7 +132,7 @@ func (config *ManagedDiskConfig) RevokeAccess() error {
132132
return err
133133
}
134134

135-
rBody, err := ioutil.ReadAll(resp.Body)
135+
rBody, err := io.ReadAll(resp.Body)
136136
if err != nil {
137137
return fmt.Errorf("failed to read response body (resp code %d): %w", resp.StatusCode, err)
138138
}

e2etest/scenario_helpers.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"context"
2727
"crypto/md5"
2828
"fmt"
29-
"io/ioutil"
29+
"io"
3030
"net/url"
3131
"os"
3232
"path"
@@ -67,7 +67,7 @@ var specialNames = []string{
6767
// note: this is to emulate the list-of-files flag
6868
// nolint
6969
func (scenarioHelper) generateListOfFiles(c asserter, fileList []string) (path string) {
70-
parentDirName, err := ioutil.TempDir("", "AzCopyLocalTest")
70+
parentDirName, err := os.MkdirTemp("", "AzCopyLocalTest")
7171
c.AssertNoErr(err)
7272

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

7878
// pipe content into it
7979
content := strings.Join(fileList, "\n")
80-
err = ioutil.WriteFile(path, []byte(content), common.DEFAULT_FILE_PERM)
80+
err = os.WriteFile(path, []byte(content), common.DEFAULT_FILE_PERM)
8181
c.AssertNoErr(err)
8282
return
8383
}
8484

8585
// nolint
8686
func (scenarioHelper) generateLocalDirectory(c asserter) (dstDirName string) {
87-
dstDirName, err := ioutil.TempDir("", "AzCopyLocalTest")
87+
dstDirName, err := os.MkdirTemp("", "AzCopyLocalTest")
8888
c.AssertNoErr(err)
8989
return
9090
}
@@ -101,7 +101,7 @@ func (scenarioHelper) generateLocalFile(filePath string, fileSize int) ([]byte,
101101
}
102102

103103
// write to file and return the data
104-
err = ioutil.WriteFile(filePath, bigBuff, common.DEFAULT_FILE_PERM)
104+
err = os.WriteFile(filePath, bigBuff, common.DEFAULT_FILE_PERM)
105105
return bigBuff, err
106106
}
107107

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

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

913-
destData, err := ioutil.ReadAll(retryReader)
913+
destData, err := io.ReadAll(retryReader)
914914
a.AssertNoErr(err)
915915
downloadResp.Body(azfile.RetryReaderOptions{})
916916
return destData

e2etest/scenario_os_helpers_for_windows.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import (
3939
type osScenarioHelper struct{}
4040

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

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

0 commit comments

Comments
 (0)