From af08844a9af039f68f0fad5db2a97d93ac3f724d Mon Sep 17 00:00:00 2001 From: Lonnie Liu Date: Mon, 15 Feb 2021 14:23:01 -0800 Subject: [PATCH] Upgrade golang compiler to latest; go fmt files. --- Dockerfile.dapper | 9 +++---- .../datasource/metadata/ec2/metadata_test.go | 24 +++++++++---------- config/cloudinit/network/debian_test.go | 8 +++---- config/config_test.go | 6 ++--- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/Dockerfile.dapper b/Dockerfile.dapper index ac412295..1be25971 100644 --- a/Dockerfile.dapper +++ b/Dockerfile.dapper @@ -111,7 +111,7 @@ ENV BUILD_DOCKER_URL=BUILD_DOCKER_URL_${ARCH} \ DISTRIB_ID=${DISTRIB_ID} \ DOWNLOADS=/usr/src/downloads \ GOPATH=/go \ - GO_VERSION=1.8.5 \ + GO_VERSION=1.15.8 \ GOARCH=$ARCH \ HOSTNAME_DEFAULT=${HOSTNAME_DEFAULT} \ IMAGE_NAME=${IMAGE_NAME} \ @@ -142,6 +142,7 @@ ENV BUILD_DOCKER_URL=BUILD_DOCKER_URL_${ARCH} \ PROXMOXVE_SERVICE=${PROXMOXVE_SERVICE} \ SKIP_BUILD=${SKIP_BUILD} ENV PATH=${GOPATH}/bin:/usr/local/go/bin:$PATH +ENV GO111MODULE=off RUN mkdir -p ${DOWNLOADS} @@ -156,11 +157,11 @@ RUN echo "... Downloading ${!KERNEL_URL}"; \ RUN curl -pfL ${SELINUX_POLICY_URL} > ${DOWNLOADS}/$(basename ${SELINUX_POLICY_URL}) # Install Go -RUN wget -O - https://storage.googleapis.com/golang/go${GO_VERSION}.linux-${GOARCH}.tar.gz | tar -xzf - -C /usr/local && \ +RUN curl -L https://storage.googleapis.com/golang/go${GO_VERSION}.linux-${GOARCH}.tar.gz | tar -xzf - -C /usr/local && \ go get github.com/burmilla/trash -RUN mkdir -p ${GOPATH}/src/golang.org/x && cd ${GOPATH}/src/golang.org/x/ && git clone https://github.com/golang/tools && \ - cd tools && git checkout 6adeb8aab2ded9eb693b831d5fd090c10a6ebdfa -b temp && go get golang.org/x/lint/golint +# Install golint +RUN go get golang.org/x/lint/golint # Install Host Docker RUN curl -fL ${!BUILD_DOCKER_URL} > /usr/bin/docker && \ diff --git a/config/cloudinit/datasource/metadata/ec2/metadata_test.go b/config/cloudinit/datasource/metadata/ec2/metadata_test.go index 1dd9e742..7641e266 100644 --- a/config/cloudinit/datasource/metadata/ec2/metadata_test.go +++ b/config/cloudinit/datasource/metadata/ec2/metadata_test.go @@ -70,13 +70,13 @@ func TestFetchMetadata(t *testing.T) { RootDisk: "/dev/xvda", NetworkConfig: netconf.NetworkConfig{ Interfaces: map[string]netconf.InterfaceConfig{ - /* "eth0": netconf.InterfaceConfig{ - Addresses: []string{ - "1.2.3.4", - "5.6.7.8", + /* "eth0": netconf.InterfaceConfig{ + Addresses: []string{ + "1.2.3.4", + "5.6.7.8", + }, }, - }, - */}, + */}, }, }, }, @@ -100,13 +100,13 @@ func TestFetchMetadata(t *testing.T) { RootDisk: "/dev/nvme0n1", NetworkConfig: netconf.NetworkConfig{ Interfaces: map[string]netconf.InterfaceConfig{ - /* "eth0": netconf.InterfaceConfig{ - Addresses: []string{ - "1.2.3.4", - "5.6.7.8", + /* "eth0": netconf.InterfaceConfig{ + Addresses: []string{ + "1.2.3.4", + "5.6.7.8", + }, }, - }, - */}, + */}, }, }, }, diff --git a/config/cloudinit/network/debian_test.go b/config/cloudinit/network/debian_test.go index da9e281d..bcce374e 100644 --- a/config/cloudinit/network/debian_test.go +++ b/config/cloudinit/network/debian_test.go @@ -20,10 +20,10 @@ import ( func TestFormatConfigs(t *testing.T) { for in, n := range map[string]int{ - "": 0, - "line1\\\nis long": 1, - "#comment": 0, - "#comment\\\ncomment": 0, + "": 0, + "line1\\\nis long": 1, + "#comment": 0, + "#comment\\\ncomment": 0, " #comment \\\n comment\nline 1\nline 2\\\n is long": 2, } { lines := formatConfig(in) diff --git a/config/config_test.go b/config/config_test.go index b4f3cefc..b765d3bc 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -198,11 +198,11 @@ func TestGet(t *testing.T) { } tests := map[string]interface{}{ - "key": "value", + "key": "value", "rancher.key2.subkey": "subvalue", "rancher.key2.subnum": 42, "rancher.key2.subkey2": "", - "foo": "", + "foo": "", } for k, v := range tests { @@ -241,7 +241,7 @@ func TestSet(t *testing.T) { } tests := map[string]interface{}{ - "key": "value2", + "key": "value2", "rancher.key2.subkey": "subvalue2", "rancher.key2.subkey2": "value", "rancher.key2.subkey3": 43,