Skip to content

Commit

Permalink
Update to the latest two versions of Go (#23536)
Browse files Browse the repository at this point in the history
* Update to the latest two versions of Go

Remove setting nocoverageredesign as the underlying issue has been
fixed, so it's no longer required.
Update to latest version of golangci-lint.

* clean up lint
  • Loading branch information
jhendrixMSFT authored Oct 3, 2024
1 parent fc43101 commit e5aec80
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 111 deletions.
2 changes: 1 addition & 1 deletion eng/pipelines/mgmt-auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extends:

- task: GoTool@0
inputs:
version: '1.22.0'
version: '1.23.2'

- task: ShellScript@2
inputs:
Expand Down
20 changes: 9 additions & 11 deletions eng/pipelines/templates/jobs/archetype-sdk-client-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,22 @@ stages:
pool.name: azsdk-pool-mms-win-2022-general
image.name: MMS2022
go.version: '1.18.10'
Linux_Go121:
Linux_Go122:
pool.name: azsdk-pool-mms-ubuntu-2004-general
image.name: MMSUbuntu20.04
go.version: '1.21.7'
Windows_Go121:
go.version: '1.22.8'
Windows_Go122:
pool.name: azsdk-pool-mms-win-2022-general
image.name: MMS2022
go.version: '1.21.7'
Linux_Go122:
go.version: '1.22.8'
Linux_Go123:
pool.name: azsdk-pool-mms-ubuntu-2004-general
image.name: MMSUbuntu20.04
go.version: '1.22.0'
GOEXPERIMENT: nocoverageredesign
Windows_Go122:
go.version: '1.23.2'
Windows_Go123:
pool.name: azsdk-pool-mms-win-2022-general
image.name: MMS2022
go.version: '1.22.0'
GOEXPERIMENT: nocoverageredesign
go.version: '1.23.2'
pool:
name: $(pool.name)
vmImage: $(image.name)
Expand Down Expand Up @@ -75,7 +73,7 @@ stages:
steps:
- task: GoTool@0
inputs:
version: '1.22.0'
version: '1.23.2'
displayName: "Select Go Version"

- template: ../steps/create-go-workspace.yml
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/templates/jobs/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ extends:

- task: GoTool@0
inputs:
version: '1.22.0'
version: '1.23.2'
displayName: "Select Go Version"

- template: /eng/pipelines/templates/steps/create-go-workspace.yml@self
Expand Down
20 changes: 9 additions & 11 deletions eng/pipelines/templates/jobs/archetype-sdk-eng-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,22 @@ stages:
pool.name: azsdk-pool-mms-win-2022-general
image.name: MMS2022
go.version: '1.18.10'
Linux_Go121:
Linux_Go122:
pool.name: azsdk-pool-mms-ubuntu-2004-general
image.name: MMSUbuntu20.04
go.version: '1.21.7'
Windows_Go121:
go.version: '1.22.8'
Windows_Go122:
pool.name: azsdk-pool-mms-win-2022-general
image.name: MMS2022
go.version: '1.21.7'
Linux_Go122:
go.version: '1.22.8'
Linux_Go123:
pool.name: azsdk-pool-mms-ubuntu-2004-general
image.name: MMSUbuntu20.04
go.version: '1.22.0'
GOEXPERIMENT: nocoverageredesign
Windows_Go122:
go.version: '1.23.2'
Windows_Go123:
pool.name: azsdk-pool-mms-win-2022-general
image.name: MMS2022
go.version: '1.22.0'
GOEXPERIMENT: nocoverageredesign
go.version: '1.23.2'
generate.bom: true
pool:
name: $(pool.name)
Expand Down Expand Up @@ -97,7 +95,7 @@ stages:

- task: GoTool@0
inputs:
version: '1.22.0'
version: '1.23.2'
displayName: "Select Go Version"

- template: ../steps/create-go-workspace.yml
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/templates/jobs/mgmt-mock-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
displayName: 'Install autorest'
- task: GoTool@0
inputs:
version: '1.22.0'
version: '1.23.2'
displayName: "Select Go Version"

- template: /eng/pipelines/templates/steps/create-go-workspace.yml
Expand Down
28 changes: 2 additions & 26 deletions eng/pipelines/templates/stages/ci-platform-matrix-complete.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,6 @@
"OSVmImage": "env:LINUXVMIMAGE", "Pool": "env:LINUXPOOL"
}
},
"go.version": ["1.21.7", "1.18.10"]
},
"include": [
{
"WindowsNoCoverage": {
"windows-22_1220_nocoverage":
{
"go.version": "1.22.0",
"GOEXPERIMENT": "nocoverageredesign",
"generate.bom": "true",
"OSVmImage": "env:WINDOWSVMIMAGE",
"Pool":"env:WINDOWSPOOL"
}
}
},
{
"LinuxNoCoverage": {
"ubuntu-2004_nocoverage": {
"go.version": "1.22.0",
"GOEXPERIMENT": "nocoverageredesign",
"OSVmImage": "env:LINUXVMIMAGE",
"Pool": "env:LINUXPOOL"
}
}
}
]
"go.version": ["1.23.2", "1.22.8", "1.18.10"]
}
}
28 changes: 2 additions & 26 deletions eng/pipelines/templates/stages/ci-platform-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,6 @@
"OSVmImage": "env:LINUXVMIMAGE", "Pool": "env:LINUXPOOL"
}
},
"go.version": ["1.21.7"]
},
"include": [
{
"WindowsNoCoverage": {
"windows-22_1220_nocoverage":
{
"go.version": "1.22.0",
"GOEXPERIMENT": "nocoverageredesign",
"generate.bom": "true",
"OSVmImage": "env:WINDOWSVMIMAGE",
"Pool":"env:WINDOWSPOOL"
}
}
},
{
"LinuxNoCoverage": {
"ubuntu-2004_nocoverage": {
"go.version": "1.22.0",
"GOEXPERIMENT": "nocoverageredesign",
"OSVmImage": "env:LINUXVMIMAGE",
"Pool": "env:LINUXPOOL"
}
}
}
]
"go.version": ["1.23.2", "1.22.8"]
}
}
23 changes: 3 additions & 20 deletions eng/pipelines/templates/stages/platform-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,8 @@
},
"GoVersion": [
"1.18.10",
"1.21.7"
"1.22.8",
"1.23.2"
]
},
"include": [
{
"Agent": {
"ubuntu-20.04": {
"OSVmImage": "env:LINUXVMIMAGE",
"Pool": "env:LINUXPOOL"
},
"windows-2022": {
"OSVmImage": "env:WINDOWSVMIMAGE",
"Pool": "env:WINDOWSPOOL"
}
},
"GoVersion": [
"1.22.0"
],
"GOEXPERIMENT": "nocoverageredesign"
}
]
}
}
2 changes: 1 addition & 1 deletion eng/pipelines/templates/variables/globals.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variables:
GoLintCLIVersion: 'v1.59.0'
GoLintCLIVersion: 'v1.61.0'
Package.EnableSBOMSigning: true
# Enable go native component governance detection
# https://docs.opensource.microsoft.com/tools/cg/index.html
Expand Down
6 changes: 3 additions & 3 deletions eng/scripts/automation_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ outputFile="$(realpath $outputFile)"
echo "output json file: $outputFile"

TMPDIR="/tmp"
if [ ! "$(go version | awk '{print $3}' | cut -c 3-6)" = "1.22" ]
if [ ! "$(go version | awk '{print $3}' | cut -c 3-6)" = "1.23" ]
then
wget -q https://golang.org/dl/go1.22.0.linux-amd64.tar.gz
tar -C $TMPDIR -xzf go1.22.0.linux-amd64.tar.gz
wget -q https://golang.org/dl/go1.23.2.linux-amd64.tar.gz
tar -C $TMPDIR -xzf go1.23.2.linux-amd64.tar.gz
export GOROOT=$TMPDIR/go
export PATH=$GOROOT/bin:$PATH
fi
Expand Down
6 changes: 3 additions & 3 deletions sdk/azcore/messaging/cloud_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package messaging

import (
"encoding/json"
"io/ioutil"
"os"
"testing"
"time"

Expand Down Expand Up @@ -110,7 +110,7 @@ func TestCloudEventUnmarshalFull(t *testing.T) {

func TestCloudEventUnmarshalFull_InteropWithPython(t *testing.T) {
// this event is a Python serialized CloudEvent
text, err := ioutil.ReadFile("testdata/cloudevent_binary_with_extensions.json")
text, err := os.ReadFile("testdata/cloudevent_binary_with_extensions.json")
require.NoError(t, err)

var ce *CloudEvent
Expand Down Expand Up @@ -141,7 +141,7 @@ func TestCloudEventUnmarshalFull_InteropWithPython(t *testing.T) {
}

func TestCloudEventUnmarshalRequiredFieldsOnly(t *testing.T) {
text, err := ioutil.ReadFile("testdata/cloudevent_required_only.json")
text, err := os.ReadFile("testdata/cloudevent_required_only.json")
require.NoError(t, err)

var ce *CloudEvent
Expand Down
2 changes: 1 addition & 1 deletion sdk/internal/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func Should(cls Event) bool {
if log.lst == nil {
return false
}
if log.cls == nil || len(log.cls) == 0 {
if len(log.cls) == 0 {
return true
}
for _, c := range log.cls {
Expand Down
2 changes: 1 addition & 1 deletion sdk/internal/recording/recording.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func init() {
certPool, err = x509.SystemCertPool()
if err != nil {
log.Println("could not create a system cert pool")
log.Panicf(err.Error())
log.Panic(err.Error())
}
}
cert, err := os.ReadFile(localFile)
Expand Down
9 changes: 4 additions & 5 deletions sdk/internal/recording/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"log"
"math/rand"
"net/http"
Expand Down Expand Up @@ -303,11 +302,11 @@ func ensureTestProxyInstalled(proxyVersion string, proxyPath string, proxyDir st
}

func getProxyLog() (*os.File, error) {
rand.Seed(time.Now().UnixNano())
rng := rand.New(rand.NewSource(time.Now().UnixNano()))
const letters = "abcdefghijklmnopqrstuvwxyz"
suffix := make([]byte, 6)
for i := range suffix {
suffix[i] = letters[rand.Intn(len(letters))]
suffix[i] = letters[rng.Intn(len(letters))]
}
proxyLogName := fmt.Sprintf("test-proxy.log.%s", suffix)
proxyLog, err := os.Create(filepath.Join(os.TempDir(), proxyLogName))
Expand All @@ -322,14 +321,14 @@ func getProxyVersion(gitRoot string) (string, error) {
overrideProxyVersionConfig := filepath.Join(gitRoot, "eng/target_proxy_version.txt")

if _, err := os.Stat(overrideProxyVersionConfig); err == nil {
version, err := ioutil.ReadFile(overrideProxyVersionConfig)
version, err := os.ReadFile(overrideProxyVersionConfig)
if err == nil {
proxyVersion := strings.TrimSpace(string(version))
return proxyVersion, nil
}
}

version, err := ioutil.ReadFile(proxyVersionConfig)
version, err := os.ReadFile(proxyVersionConfig)
if err != nil {
return "", err
}
Expand Down

0 comments on commit e5aec80

Please sign in to comment.