Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Golang Version 1.22.6 and Golangci lint version v1.61.0 #3988

Merged
merged 25 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f49b5eb
update_goversion_go.mod_go.sum
0xaravindh Sep 13, 2024
8a3bbec
updated_build_dockerfile_goversion
0xaravindh Sep 13, 2024
e78c37c
updated_example_dockerfile_goversion
0xaravindh Sep 13, 2024
0beb430
update_the_example_images_tag
0xaravindh Sep 13, 2024
a5afc3e
Update the k8s error handler
0xaravindh Sep 13, 2024
8154246
Merge branch 'googleforgames:main' into main
0xaravindh Sep 17, 2024
0e7e5c0
v1.61.0 update
0xaravindh Sep 17, 2024
4075607
Merge branch 'googleforgames:main' into main
0xaravindh Sep 18, 2024
c7471aa
lint fixes
vicentefb Sep 19, 2024
2ff4eac
lint fix
0xaravindh Sep 19, 2024
85e7320
Merge branch 'googleforgames:main' into main
0xaravindh Sep 20, 2024
b4787a8
Merge branch 'main' of https://github.com/0xaravindh/agones into gola…
0xaravindh Sep 20, 2024
9e70a88
Merge branch 'googleforgames:main' into main
0xaravindh Sep 23, 2024
f5e69a8
Merge branch 'main' of https://github.com/0xaravindh/agones into gola…
0xaravindh Sep 23, 2024
128ed31
go-version update
0xaravindh Sep 23, 2024
756ab2a
go.mod fixes
0xaravindh Sep 24, 2024
8ec791f
Merge branch 'googleforgames:main' into main
0xaravindh Sep 25, 2024
dab7a65
Merge branch 'main' into golangci-lint-version-update
gongmax Sep 27, 2024
6a36e50
gen-api-docs shell script update
0xaravindh Sep 30, 2024
68dd3d2
fix: updated gRPC lint issue and remove deprecated features
0xaravindh Oct 1, 2024
910deb6
Regenerated Go code for SDK and GRPC services
0xaravindh Oct 1, 2024
4c8693d
fix: updated beta method in http-api-test
0xaravindh Oct 1, 2024
4903d49
Fix: Update gRPC client connection to use DialContext
0xaravindh Oct 1, 2024
5dc238d
Merge branch 'main' into golangci-lint-version-update
gongmax Oct 2, 2024
17896ed
Merge branch 'main' into golangci-lint-version-update
gongmax Oct 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ KIND_PROFILE ?= agones
KIND_CONTAINER_NAME=$(KIND_PROFILE)-control-plane

# Game Server image to use while doing end-to-end tests
GS_TEST_IMAGE ?= us-docker.pkg.dev/agones-images/examples/simple-game-server:0.34
GS_TEST_IMAGE ?= us-docker.pkg.dev/agones-images/examples/simple-game-server:0.35

# Enable all beta feature gates. Keep in sync with `true` (beta) entries in pkg/util/runtime/features.go:featureDefaults
BETA_FEATURE_GATES ?= "AutopilotPassthroughPort=true&CountsAndLists=true&DisableResyncOnSDKServer=true"
Expand Down
2 changes: 1 addition & 1 deletion build/agones-bot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.21 AS build-env
FROM golang:1.22 AS build-env
COPY . /go-src
WORKDIR /go-src
RUN CGO_ENABLED=0 go build -o /go-app .
Expand Down
2 changes: 1 addition & 1 deletion build/agones-bot/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

module github-bot

go 1.21
go 1.22

require (
github.com/GoogleCloudPlatform/cloud-build-notifiers/lib/notifiers v0.0.0-20210219212036-163c92a64b27
Expand Down
4 changes: 2 additions & 2 deletions build/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN gem install fpm && \

# install go
WORKDIR /usr/local
ENV GO_VERSION=1.21.12
ENV GO_VERSION=1.22.6
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 @@ -78,7 +78,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.51.2
RUN go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.61.0

# Install yamllint
RUN apt-get update && \
Expand Down
2 changes: 1 addition & 1 deletion 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.21.12
ENV GO_VERSION=1.22.6
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/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.21.12
ENV GO_VERSION=1.22.6
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.21.12
ENV GO_VERSION=1.22.6
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 build/report/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ steps:
id: build-report
script: |
#!/usr/bin/env bash
export GO_VERSION=1.21.12
export GO_VERSION=1.22.6
cd /usr/local
curl -SsL https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz | tar -xzf-
export PATH=/usr/local/go/bin:${PATH}
Expand Down
1 change: 0 additions & 1 deletion build/report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ func main() {
}
if err != nil {
log.Fatalf("error listing builds: %v", err)
break
}
createTime := resp.CreateTime.AsTime()
if createTime.Before(windowStart) {
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/k8s-export-openapi/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/agones/agones/build/scripts/k8s-export-openapi

go 1.21
go 1.22

require github.com/itchyny/json2yaml v0.1.4
2 changes: 1 addition & 1 deletion build/scripts/previousversion/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/agones/agones/build/scripts/previousversion

go 1.21
go 1.22

require github.com/blang/semver/v4 v4.0.0
2 changes: 1 addition & 1 deletion build/scripts/site-config-update-version/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/agones/agones/build/scripts/site-config-update-version

go 1.21
go 1.22

require github.com/pelletier/go-toml v1.9.5
18 changes: 9 additions & 9 deletions cmd/allocator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,10 @@ func runHTTP(listenCtx context.Context, workerCtx context.Context, h *serviceHan
if err == http.ErrServerClosed {
logger.WithError(err).Info("HTTP/HTTPS server closed")
os.Exit(0)
} else {
logger.WithError(err).Fatal("Unable to start HTTP/HTTPS listener")
os.Exit(1)
}
gongmax marked this conversation as resolved.
Show resolved Hide resolved
logger.WithError(err).Fatal("Unable to start HTTP/HTTPS listener")
os.Exit(1)

}()
}

Expand All @@ -422,10 +422,10 @@ func runGRPC(ctx context.Context, h *serviceHandler, grpcHealth *grpchealth.Serv
if err != nil {
logger.WithError(err).Fatal("allocation service crashed")
os.Exit(1)
} else {
logger.Info("allocation server closed")
os.Exit(0)
}
logger.Info("allocation server closed")
os.Exit(0)

}()
}

Expand Down Expand Up @@ -545,15 +545,15 @@ func (h *serviceHandler) getGRPCServerOptions() []grpc.ServerOption {
return append([]grpc.ServerOption{grpc.Creds(credentials.NewTLS(cfg))}, opts...)
}

func (h *serviceHandler) getTLSCert(ch *tls.ClientHelloInfo) (*tls.Certificate, error) {
func (h *serviceHandler) getTLSCert(_ *tls.ClientHelloInfo) (*tls.Certificate, error) {
gongmax marked this conversation as resolved.
Show resolved Hide resolved
h.tlsMutex.RLock()
defer h.tlsMutex.RUnlock()
return h.tlsCert, nil
}

// verifyClientCertificate verifies that the client certificate is accepted
// This method is used as GetConfigForClient is cross lang incompatible.
func (h *serviceHandler) verifyClientCertificate(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {
func (h *serviceHandler) verifyClientCertificate(rawCerts [][]byte, _ [][]*x509.Certificate) error {
opts := x509.VerifyOptions{
Roots: h.caCertPool,
CurrentTime: time.Now(),
Expand Down Expand Up @@ -656,7 +656,7 @@ type serviceHandler struct {
}

// Allocate implements the Allocate gRPC method definition
func (h *serviceHandler) Allocate(ctx context.Context, in *pb.AllocationRequest) (*pb.AllocationResponse, error) {
func (h *serviceHandler) Allocate(_ context.Context, in *pb.AllocationRequest) (*pb.AllocationResponse, error) {
logger.WithField("request", in).Infof("allocation request received.")
gsa := converters.ConvertAllocationRequestToGSA(in)
gsa.ApplyDefaults()
Expand Down
8 changes: 4 additions & 4 deletions cmd/allocator/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestAllocateHandler(t *testing.T) {
t.Parallel()

h := serviceHandler{
allocationCallback: func(gsa *allocationv1.GameServerAllocation) (k8sruntime.Object, error) {
allocationCallback: func(_ *allocationv1.GameServerAllocation) (k8sruntime.Object, error) {
return &allocationv1.GameServerAllocation{
ObjectMeta: metav1.ObjectMeta{
Namespace: "default",
Expand Down Expand Up @@ -71,7 +71,7 @@ func TestAllocateHandlerReturnsError(t *testing.T) {
t.Parallel()

h := serviceHandler{
allocationCallback: func(gsa *allocationv1.GameServerAllocation) (k8sruntime.Object, error) {
allocationCallback: func(_ *allocationv1.GameServerAllocation) (k8sruntime.Object, error) {
return nil, k8serror.NewBadRequest("error")
},
}
Expand Down Expand Up @@ -110,7 +110,7 @@ func TestHandlingStatus(t *testing.T) {

errorMessage := "GameServerAllocation is invalid"
h := serviceHandler{
allocationCallback: func(gsa *allocationv1.GameServerAllocation) (k8sruntime.Object, error) {
allocationCallback: func(_ *allocationv1.GameServerAllocation) (k8sruntime.Object, error) {
return &metav1.Status{
Status: metav1.StatusFailure,
Message: errorMessage,
Expand Down Expand Up @@ -142,7 +142,7 @@ func TestBadReturnType(t *testing.T) {
t.Parallel()

h := serviceHandler{
allocationCallback: func(gsa *allocationv1.GameServerAllocation) (k8sruntime.Object, error) {
allocationCallback: func(_ *allocationv1.GameServerAllocation) (k8sruntime.Object, error) {
return &corev1.Secret{}, nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ping/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func serveHTTP(ctlConf config, h healthcheck.Handler) func() {
// add health check as well
mux.HandleFunc("/live", h.LiveEndpoint)

mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
mux.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
if _, err := w.Write([]byte(ctlConf.HTTPResponse)); err != nil {
w.WriteHeader(http.StatusInternalServerError)
logger.WithError(err).Error("Error responding to http request")
Expand Down
2 changes: 1 addition & 1 deletion cmd/ping/udp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func TestUDPServerHealth(t *testing.T) {

cancel()

err = wait.PollUntilContextTimeout(context.Background(), time.Second, 5*time.Second, true, func(ctx context.Context) (bool, error) {
err = wait.PollUntilContextTimeout(context.Background(), time.Second, 5*time.Second, true, func(_ context.Context) (bool, error) {
return u.Health() != nil, nil
})

Expand Down
2 changes: 1 addition & 1 deletion cmd/sdk-server/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestHealthCheckWrapper(t *testing.T) {
{"non-empty body", bytes.NewBuffer([]byte(`{}`)), http.StatusOK},
}

testWrapper := healthCheckWrapper(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
testWrapper := healthCheckWrapper(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
}))

Expand Down
2 changes: 1 addition & 1 deletion examples/allocation-endpoint/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ PROD_REPO ?= us-docker.pkg.dev/agones-images/examples
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_path := $(dir $(mkfile_path))
root_path = $(realpath $(project_path)/../..)
version := 0.9
version := 0.10
ifeq ($(REPOSITORY),)
server_tag := allocation-endpoint-proxy:$(version)
else
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.21
go 1.22

require (
agones.dev/agones v1.35.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.21-alpine
FROM golang:1.22-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.21
go 1.22

require (
agones.dev/agones v1.35.0
Expand Down
2 changes: 1 addition & 1 deletion examples/allocation-endpoint/terraform/variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ variable "project_id" {
variable "ae_proxy_image" {
type = string
description = "The docker image of the allocation proxy."
default = "us-docker.pkg.dev/agones-images/examples/allocation-endpoint-proxy:0.9"
default = "us-docker.pkg.dev/agones-images/examples/allocation-endpoint-proxy:0.10"
}

variable "region" {
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.21.12 as builder
FROM golang:1.22.6 as builder
WORKDIR /go/src
COPY . agones.dev/agones

Expand Down
2 changes: 1 addition & 1 deletion examples/autoscaler-webhook/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ PROD_REPO ?= us-docker.pkg.dev/agones-images/examples
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
project_path := $(dir $(mkfile_path))
root_path := $(realpath $(project_path)/../..)
version := 0.14
version := 0.15
ifeq ($(REPOSITORY),)
autoscaler_webhook_tag := autoscaler-webhook:$(version)
else
Expand Down
2 changes: 1 addition & 1 deletion examples/autoscaler-webhook/autoscaler-service-tls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ spec:
secretName: autoscalersecret
containers:
- name: autoscaler-webhook
image: us-docker.pkg.dev/agones-images/examples/autoscaler-webhook:0.14
image: us-docker.pkg.dev/agones-images/examples/autoscaler-webhook:0.15
imagePullPolicy: Always
volumeMounts:
- mountPath: /home/service/certs
Expand Down
2 changes: 1 addition & 1 deletion examples/autoscaler-webhook/autoscaler-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
# serviceAccount: autoscaler-webhook
containers:
- name: autoscaler-webhook
image: us-docker.pkg.dev/agones-images/examples/autoscaler-webhook:0.14
image: us-docker.pkg.dev/agones-images/examples/autoscaler-webhook:0.15
imagePullPolicy: Always
ports:
- name: autoscaler
Expand Down
22 changes: 11 additions & 11 deletions examples/autoscaler-webhook/go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
module autoscaler-webhook

go 1.21
go 1.22

require agones.dev/agones v1.35.0

require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/spec v0.19.5 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect
Expand All @@ -32,6 +31,7 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
Expand Down Expand Up @@ -60,14 +60,14 @@ require (
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.28.6 // indirect
k8s.io/apimachinery v0.28.6 // indirect
k8s.io/client-go v0.28.6 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/api v0.29.7 // indirect
k8s.io/apimachinery v0.29.7 // indirect
k8s.io/client-go v0.29.7 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

Expand Down
Loading
Loading