Skip to content

Commit

Permalink
Upgrade Go version to 1.19.1 (#2743)
Browse files Browse the repository at this point in the history
Upgrade Go version to 1.19.

Also bump golangci-lint version, and make change to mitigate linter complaints.
  • Loading branch information
gongmax authored Sep 23, 2022
1 parent a531e1f commit 261d808
Show file tree
Hide file tree
Showing 35 changed files with 77 additions and 1,184 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,13 @@ linters-settings:
rangeValCopy:
sizeThreshold: 512
skipTestFuncs: true
revive:
confidence: 0.8

issues:
# This turns off the default excludes - which was causing the linter
# to miss things like erroneous comments
exclude-use-default: false
exclude:
- Using the variable on range scope .* in function literal
- "SA1019: \"io/ioutil\" has been deprecated since Go 1.16"
4 changes: 2 additions & 2 deletions build/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ RUN apt-get update && \

# install go
WORKDIR /usr/local
ENV GO_VERSION=1.17.2
ENV GO_VERSION=1.19.1
ENV GOPATH /go
ENV GO111MODULE=on
RUN wget -q https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
Expand Down Expand Up @@ -67,7 +67,7 @@ RUN curl -L ${HELM_URL} > /tmp/helm.tar.gz \
RUN echo "source <(helm completion bash)" >> /root/.bashrc

# install golang-ci linter
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.43.0
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.49.0

#
# \ \ / /__| |__ ___(_) |_ ___
Expand Down
6 changes: 3 additions & 3 deletions build/build-sdk-images/go/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN apt-get --allow-releaseinfo-change update && \

# install go
WORKDIR /usr/local
ENV GO_VERSION=1.17.2
ENV GO_VERSION=1.19.1
ENV GO111MODULE=on
ENV GOPATH /go
RUN wget -q https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
Expand All @@ -29,8 +29,8 @@ RUN wget -q https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
ENV PATH /usr/local/go/bin:/go/bin:$PATH

# install go-proto-gen 1.1
RUN go get github.com/golang/protobuf/[email protected] && \
go get -u golang.org/x/tools/cmd/goimports
RUN go install github.com/golang/protobuf/[email protected] && \
go install golang.org/x/tools/cmd/goimports@latest


# code generation scripts
Expand Down
2 changes: 1 addition & 1 deletion build/build-sdk-images/restapi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN apt-get --allow-releaseinfo-change update && \

# install go
WORKDIR /usr/local
ENV GO_VERSION=1.17.2
ENV GO_VERSION=1.19.1
ENV GO111MODULE=on
ENV GOPATH /go
RUN wget -q https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
Expand Down
2 changes: 1 addition & 1 deletion build/e2e-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apt-get update && \

# install go
WORKDIR /usr/local
ENV GO_VERSION=1.17.2
ENV GO_VERSION=1.19.1
ENV GOPATH /go
ENV GO111MODULE=on
RUN wget -q https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \
Expand Down
2 changes: 1 addition & 1 deletion cmd/allocator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
10 changes: 6 additions & 4 deletions cmd/allocator/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -18,7 +18,6 @@ import (
"crypto/tls"
"crypto/x509"
"encoding/pem"
"io/ioutil"
"net/http"
"os"
"testing"
Expand Down Expand Up @@ -197,14 +196,17 @@ func TestVerifyClientCertificateFails(t *testing.T) {
func TestGettingCaCert(t *testing.T) {
t.Parallel()

file, err := ioutil.TempFile(".", "*.crt")
file, err := os.CreateTemp(".", "*.crt")
if assert.Nil(t, err) {
defer os.Remove(file.Name()) // nolint: errcheck
_, err = file.WriteString(clientCert)
if assert.Nil(t, err) {
certPool, err := getCACertPool("./")
if assert.Nil(t, err) {
assert.Len(t, certPool.Subjects(), 1)
// linting complaints certPool.Subjects() has been deprecated since Go 1.18.
// But since this cert doesn't come from SystemCertPool, it doesn't seem behavior
// should be impacted. So marking the lint as ignored.
assert.Len(t, certPool.Subjects(), 1) // nolint
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/allocator/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion examples/allocation-endpoint/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ REPOSITORY = gcr.io/agones-images
# Directory that this Makefile is in.
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_path := $(dir $(mkfile_path))
server_tag = $(REPOSITORY)/allocation-endpoint-proxy:0.1
server_tag = $(REPOSITORY)/allocation-endpoint-proxy:0.2
root_path = $(realpath $(project_path)/../..)

# _____ _
Expand Down
2 changes: 1 addition & 1 deletion examples/allocation-endpoint/client/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module agones.dev/agones/examples/allocation-endpoint/client

go 1.18
go 1.19

require (
agones.dev/agones v1.21.0
Expand Down
2 changes: 1 addition & 1 deletion examples/allocation-endpoint/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# syntax=docker/dockerfile:1

FROM golang:1.16-alpine
FROM golang:1.19-alpine

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion examples/allocation-endpoint/server/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module agones.dev/agones/examples/allocation-endpoint/server

go 1.18
go 1.19

require (
agones.dev/agones v1.21.0
Expand Down
2 changes: 1 addition & 1 deletion examples/autoscaler-webhook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# Gather dependencies and build the executable
FROM golang:1.17.2 as builder
FROM golang:1.19.1 as builder
WORKDIR /go/src/autoscaler-webhook

COPY examples/autoscaler-webhook/main.go .
Expand Down
2 changes: 1 addition & 1 deletion examples/autoscaler-webhook/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ REPOSITORY = gcr.io/agones-images

mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_path := $(dir $(mkfile_path))
autoscaler_webhook_tag = $(REPOSITORY)/autoscaler-webhook:0.4
autoscaler_webhook_tag = $(REPOSITORY)/autoscaler-webhook:0.5
root_path = $(realpath $(project_path)/../..)

# _____ _
Expand Down
2 changes: 1 addition & 1 deletion examples/crd-client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# Gather dependencies and build the executable
FROM golang:1.17.2 as builder
FROM golang:1.19.1 as builder
WORKDIR /go/src/crd-client

COPY ./main.go .
Expand Down
2 changes: 1 addition & 1 deletion examples/crd-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

REPOSITORY ?= gcr.io/agones-images

server_tag = $(REPOSITORY)/crd-client:0.6
server_tag = $(REPOSITORY)/crd-client:0.7

# _____ _
# |_ _|_ _ _ __ __ _ ___| |_ ___
Expand Down
2 changes: 1 addition & 1 deletion examples/simple-game-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# build
FROM golang:1.17.2 as builder
FROM golang:1.19.1 as builder
WORKDIR /go/src
COPY . agones.dev/agones

Expand Down
2 changes: 1 addition & 1 deletion examples/simple-game-server/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ WITH_ARM64=1

mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_path := $(dir $(mkfile_path))
server_tag = $(REGISTRY)/simple-game-server:0.13
server_tag = $(REGISTRY)/simple-game-server:0.14

ifeq ($(WITH_WINDOWS), 1)
server_tag_linux_amd64 = $(server_tag)-linux-amd64
Expand Down
12 changes: 6 additions & 6 deletions examples/simple-game-server/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module agones.dev/agones/examples/simple-game-server

go 1.17
go 1.19

require agones.dev/agones v0.0.0

Expand All @@ -9,11 +9,11 @@ require (
github.com/grpc-ecosystem/grpc-gateway v1.11.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
golang.org/x/text v0.3.6 // indirect
google.golang.org/genproto v0.0.0-20201110150050-8816d57aaa9a // indirect
google.golang.org/grpc v1.27.1 // indirect
google.golang.org/protobuf v1.26.0 // indirect
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1 // indirect
google.golang.org/grpc v1.36.1 // indirect
google.golang.org/protobuf v1.27.1 // indirect
)

replace agones.dev/agones => ../../
Loading

0 comments on commit 261d808

Please sign in to comment.