Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
use go 1.19 (#5078)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrancis authored Feb 28, 2023
1 parent 4c14b50 commit 6a2ef69
Show file tree
Hide file tree
Showing 259 changed files with 26,218 additions and 3,764 deletions.
2 changes: 1 addition & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Go for aks-engine",
"image": "mcr.microsoft.com/oss/azcu/go-dev:v1.34.7",
"image": "mcr.microsoft.com/oss/azcu/go-dev:v1.36.1",
"extensions": [
"ms-vscode.go"
],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
docker run --rm \
-v ${GITHUB_WORKSPACE}:/go/src/github.com/Azure/aks-engine \
-w /go/src/github.com/Azure/aks-engine \
mcr.microsoft.com/oss/azcu/go-dev:v1.34.7 make dist
mcr.microsoft.com/oss/azcu/go-dev:v1.36.1 make dist
- name: Rename outputs
run: |
mkdir ./outputs
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/pr-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pr:
resources:
containers:
- container: dev1
image: mcr.microsoft.com/oss/azcu/go-dev:v1.34.7
image: mcr.microsoft.com/oss/azcu/go-dev:v1.36.1

jobs:
- job: unit_tests
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/vhd-builder-ubuntu-gen2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ trigger: none
# - POST a new SKU to azure marketplace

variables:
CONTAINER_IMAGE: 'mcr.microsoft.com/oss/azcu/go-dev:v1.34.7'
CONTAINER_IMAGE: 'mcr.microsoft.com/oss/azcu/go-dev:v1.36.1'

phases:
- phase: build_vhd
Expand Down
4 changes: 2 additions & 2 deletions .pipelines/vhd-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ trigger: none
jobs:
- job: create_ubuntu_18_04_vhd
variables:
CONTAINER_IMAGE: 'mcr.microsoft.com/oss/azcu/go-dev:v1.34.7'
CONTAINER_IMAGE: 'mcr.microsoft.com/oss/azcu/go-dev:v1.36.1'
pool:
vmImage: 'Ubuntu 20.04'
steps:
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
displayName: Getting Shared Access Signature URI
- job: create_ubuntu_20_04_vhd
variables:
CONTAINER_IMAGE: 'mcr.microsoft.com/oss/azcu/go-dev:v1.34.7'
CONTAINER_IMAGE: 'mcr.microsoft.com/oss/azcu/go-dev:v1.36.1'
pool:
vmImage: 'Ubuntu 20.04'
steps:
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.2

ARG GO_VERSION=1.16
ARG GO_VERSION=1.19
ARG GO_IMAGE=golang:${GO_VERSION}


Expand Down Expand Up @@ -30,4 +30,3 @@ RUN \
# Alaways last so a simple `docker build` with no `--target` will produce the binary
FROM scratch AS binary
COPY --from=build /go/src/github.com/azure/aks-engine/bin/* /

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ifeq ($(GITTAG),)
GITTAG := $(VERSION_SHORT)
endif

DEV_ENV_IMAGE := mcr.microsoft.com/oss/azcu/go-dev:v1.34.7
DEV_ENV_IMAGE := mcr.microsoft.com/oss/azcu/go-dev:v1.36.1
DEV_ENV_WORK_DIR := /aks-engine
DEV_ENV_OPTS := --rm -v $(GOPATH)/pkg/mod:/go/pkg/mod -v $(CURDIR):$(DEV_ENV_WORK_DIR) -w $(DEV_ENV_WORK_DIR) $(DEV_ENV_VARS)
DEV_ENV_CMD := docker run $(DEV_ENV_OPTS) $(DEV_ENV_IMAGE)
Expand Down
10 changes: 5 additions & 5 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"context"
"encoding/base64"
"fmt"
"io/ioutil"
"io"
"math/rand"
"os"
"path"
Expand Down Expand Up @@ -146,7 +146,7 @@ func (dc *deployCmd) mergeAPIModel() error {
if dc.apimodelPath == "" {
log.Infoln("no --api-model was specified, using default model")
var f *os.File
f, err = ioutil.TempFile("", fmt.Sprintf("%s-default-api-model_%s-%s_", filepath.Base(os.Args[0]), BuildSHA, GitTreeState))
f, err = os.CreateTemp("", fmt.Sprintf("%s-default-api-model_%s-%s_", filepath.Base(os.Args[0]), BuildSHA, GitTreeState))
if err != nil {
return errors.Wrap(err, "error creating temp file for default API model")
}
Expand Down Expand Up @@ -203,10 +203,10 @@ func (dc *deployCmd) loadAPIModel() error {
}

if dc.caCertificatePath != "" {
if caCertificateBytes, err = ioutil.ReadFile(dc.caCertificatePath); err != nil {
if caCertificateBytes, err = os.ReadFile(dc.caCertificatePath); err != nil {
return errors.Wrap(err, "failed to read CA certificate file")
}
if caKeyBytes, err = ioutil.ReadFile(dc.caPrivateKeyPath); err != nil {
if caKeyBytes, err = os.ReadFile(dc.caPrivateKeyPath); err != nil {
return errors.Wrap(err, "failed to read CA private key file")
}

Expand Down Expand Up @@ -478,7 +478,7 @@ func (dc *deployCmd) run() error {
); err != nil {
if res.Response.Response != nil && res.Body != nil {
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
body, _ := io.ReadAll(res.Body)
log.Errorf(string(body))
}
return err
Expand Down
3 changes: 1 addition & 2 deletions cmd/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package cmd

import (
"fmt"
"io/ioutil"
"os"
"path"
"strconv"
Expand Down Expand Up @@ -1207,7 +1206,7 @@ func TestAPIModelWithContainerMonitoringAddonWithWorkspaceGuidAndKeyConfigInCmd(
}

func makeTmpFile(t *testing.T, name string) (string, func()) {
tmpF, err := ioutil.TempFile(os.TempDir(), name)
tmpF, err := os.CreateTemp(os.TempDir(), name)
if err != nil {
t.Fatalf("unable to create file: %s", err.Error())
}
Expand Down
5 changes: 2 additions & 3 deletions cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package cmd

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

Expand Down Expand Up @@ -168,10 +167,10 @@ func (gc *generateCmd) loadAPIModel() error {
return errors.New("--ca-certificate-path and --ca-private-key-path must be specified together")
}
if gc.caCertificatePath != "" {
if caCertificateBytes, err = ioutil.ReadFile(gc.caCertificatePath); err != nil {
if caCertificateBytes, err = os.ReadFile(gc.caCertificatePath); err != nil {
return errors.Wrap(err, "failed to read CA certificate file")
}
if caKeyBytes, err = ioutil.ReadFile(gc.caPrivateKeyPath); err != nil {
if caKeyBytes, err = os.ReadFile(gc.caPrivateKeyPath); err != nil {
return errors.Wrap(err, "failed to read CA private key file")
}

Expand Down
10 changes: 6 additions & 4 deletions cmd/get_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package cmd
import (
"context"
"fmt"
"io/ioutil"
"net/url"
"os"
"path"
Expand All @@ -25,6 +24,8 @@ import (
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/text/cases"
"golang.org/x/text/language"
)

const (
Expand Down Expand Up @@ -188,7 +189,7 @@ func (glc *getLogsCmd) loadAPIModel() (err error) {

func (glc *getLogsCmd) init() (err error) {
if glc.linuxScriptPath != "" {
sc, err := ioutil.ReadFile(glc.linuxScriptPath)
sc, err := os.ReadFile(glc.linuxScriptPath)
if err != nil {
return errors.Wrapf(err, "error reading log collection script %s", glc.linuxScriptPath)
}
Expand All @@ -201,7 +202,7 @@ func (glc *getLogsCmd) init() (err error) {
PrivateKeyPath: glc.linuxSSHPrivateKeyPath,
}
if glc.windowsScriptPath != "" {
sc, err := ioutil.ReadFile(glc.windowsScriptPath)
sc, err := os.ReadFile(glc.windowsScriptPath)
if err != nil {
return errors.Wrapf(err, "error reading log collection script %s", glc.windowsScriptPath)
}
Expand Down Expand Up @@ -287,7 +288,8 @@ func getClusterNodes(glc *getLogsCmd, kubeClient kubernetes.NodeLister) (nodes [
}
for _, node := range nodeList.Items {
if isMasterNode(node.Name, glc.cs.Properties.GetMasterVMPrefix()) || !glc.controlPlaneOnly {
switch api.OSType(strings.Title(node.Status.NodeInfo.OperatingSystem)) {
caser := cases.Title(language.English)
switch api.OSType(caser.String(node.Status.NodeInfo.OperatingSystem)) {
case api.Linux:
nodes = append(nodes, &ssh.RemoteHost{
URI: node.Name, Port: 22, OperatingSystem: api.Linux, AuthConfig: glc.linuxAuthConfig, Jumpbox: glc.jumpbox})
Expand Down
5 changes: 2 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -326,7 +325,7 @@ func getCompletionCmd(root *cobra.Command) *cobra.Command {

func writeCustomCloudProfile(cs *api.ContainerService) error {

tmpFile, err := ioutil.TempFile("", "azurestackcloud.json")
tmpFile, err := os.CreateTemp("", "azurestackcloud.json")
tmpFileName := tmpFile.Name()
if err != nil {
return err
Expand All @@ -338,7 +337,7 @@ func writeCustomCloudProfile(cs *api.ContainerService) error {
if err != nil {
return err
}
if err = ioutil.WriteFile(tmpFileName, []byte(content), os.ModeAppend); err != nil {
if err = os.WriteFile(tmpFileName, []byte(content), os.ModeAppend); err != nil {
return err
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package cmd

import (
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
Expand Down Expand Up @@ -126,6 +125,7 @@ func TestGetSelectedCloudFromAzConfig(t *testing.T) {
`), "myCloud"},
} {
t.Run(test.desc, func(t *testing.T) {
test := test
t.Parallel()

f, err := ini.Load(test.data)
Expand Down Expand Up @@ -208,7 +208,7 @@ func TestWriteCustomCloudProfile(t *testing.T) {
t.Fatalf("failed to write custom cloud profile: file %s does not exist", environmentFilePath)
}

azurestackenvironment, err := ioutil.ReadFile(environmentFilePath)
azurestackenvironment, err := os.ReadFile(environmentFilePath)
if err != nil {
t.Fatalf("failed to write custom cloud profile: can not read file %s ", environmentFilePath)
}
Expand Down Expand Up @@ -600,7 +600,7 @@ func TestWriteArtifacts(t *testing.T) {
}

func makeTmpDir(t *testing.T) (string, func()) {
tmpDir, err := ioutil.TempDir(os.TempDir(), "_tmp_dir")
tmpDir, err := os.MkdirTemp(os.TempDir(), "_tmp_dir")
if err != nil {
t.Fatalf("unable to create dir: %s", err.Error())
}
Expand Down
12 changes: 7 additions & 5 deletions cmd/rotate_certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package cmd
import (
"context"
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"
Expand All @@ -24,6 +23,8 @@ import (
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"golang.org/x/text/cases"
"golang.org/x/text/language"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -171,7 +172,7 @@ func (rcc *rotateCertsCmd) validateArgs() (err error) {
return errors.Errorf("error creating output directory (%s)", rcc.outputDirectory)
}
}
if _, err := ioutil.ReadDir(rcc.outputDirectory); err != nil {
if _, err := os.ReadDir(rcc.outputDirectory); err != nil {
return errors.Wrapf(err, "reading output directory %s", rcc.outputDirectory)
}
return nil
Expand Down Expand Up @@ -346,7 +347,8 @@ func (rcc *rotateCertsCmd) getAgentNodes() (nodeMap, error) {
Port: 22,
Jumpbox: rcc.jumpbox,
}
switch api.OSType(strings.Title(nli.Status.NodeInfo.OperatingSystem)) {
caser := cases.Title(language.English)
switch api.OSType(caser.String(nli.Status.NodeInfo.OperatingSystem)) {
case api.Linux:
node.OperatingSystem = api.Linux
node.AuthConfig = rcc.linuxAuthConfig
Expand Down Expand Up @@ -650,7 +652,7 @@ func (rcc *rotateCertsCmd) getKubeClient() (*kubernetes.CompositeClientSet, erro
configPathSuffix := path.Join("kubeconfig", fmt.Sprintf("kubeconfig.%s.json", rcc.location))

oldConfigPath := path.Join(rcc.backupDirectory, configPathSuffix)
oldConfig, err := ioutil.ReadFile(oldConfigPath)
oldConfig, err := os.ReadFile(oldConfigPath)
if err != nil {
return nil, errors.Wrapf(err, "reading %s", oldConfigPath)
}
Expand All @@ -660,7 +662,7 @@ func (rcc *rotateCertsCmd) getKubeClient() (*kubernetes.CompositeClientSet, erro
}

newConfigPath := path.Join(rcc.outputDirectory, configPathSuffix)
newConfig, err := ioutil.ReadFile(newConfigPath)
newConfig, err := os.ReadFile(newConfigPath)
if err != nil {
return nil, errors.Wrapf(err, "reading %s", newConfigPath)
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package cmd
import (
"context"
"fmt"
"io/ioutil"
"os"
"path/filepath"

Expand Down Expand Up @@ -379,7 +378,7 @@ func (uc *upgradeCmd) run(cmd *cobra.Command, args []string) error {
if err != nil {
return errors.Wrap(err, "reading --kubeconfig")
}
content, err = ioutil.ReadFile(path)
content, err = os.ReadFile(path)
if err != nil {
return errors.Wrap(err, "reading --kubeconfig")
}
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Azure/aks-engine

go 1.17
go 1.19

require (
github.com/Azure/azure-sdk-for-go v43.0.0+incompatible
Expand Down Expand Up @@ -32,6 +32,7 @@ require (
github.com/x-cray/logrus-prefixed-formatter v0.5.2
golang.org/x/crypto v0.0.0-20220214200702-86341886e292
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/text v0.7.0
gopkg.in/go-playground/validator.v9 v9.25.0
gopkg.in/ini.v1 v1.41.0
k8s.io/api v0.24.7
Expand Down Expand Up @@ -79,9 +80,8 @@ require (
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,9 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 h1:rm+CHSpPEEW2IsXUib1ThaHIjuBVZjxNgSKmBLFfD4c=
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand All @@ -511,8 +512,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
4 changes: 2 additions & 2 deletions hack/tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ $(LOCALBIN)/gox:
GOBIN=$(LOCALBIN) $(GO) install github.com/mitchellh/gox@v1.0.1

$(LOCALBIN)/ginkgo:
GOBIN=$(LOCALBIN) $(GO) install github.com/onsi/ginkgo/ginkgo@v1.15.0
GOBIN=$(LOCALBIN) $(GO) install github.com/onsi/ginkgo/ginkgo@v1.16.5

$(LOCALBIN)/golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(LOCALBIN) v1.50.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(LOCALBIN) v1.51.2

$(LOCALBIN)/pub:
GOBIN=$(LOCALBIN) $(GO) install github.com/devigned/pub@v0.3.3
Expand Down
2 changes: 1 addition & 1 deletion makedev.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$DEV_ENV_IMAGE = "mcr.microsoft.com/oss/azcu/go-dev:v1.34.7"
$DEV_ENV_IMAGE = "mcr.microsoft.com/oss/azcu/go-dev:v1.36.1"
$DEV_ENV_WORK_DIR = "/aks-engine"

# Ensure docker is configured for linux containers
Expand Down
Loading

0 comments on commit 6a2ef69

Please sign in to comment.