Skip to content

Commit 589c33a

Browse files
committed
chore: upgrade upstream.List and loadbalancer.TCP to Go 1.23
- Use iterators across the code instead of copying slices. - Run rekres. - Bump deps. Signed-off-by: Dmitriy Matrenichev <[email protected]>
1 parent 0639758 commit 589c33a

File tree

14 files changed

+254
-115
lines changed

14 files changed

+254
-115
lines changed

.github/renovate.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"description": "THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.",
4+
"prHeader": "Update Request | Renovate Bot",
5+
"extends": [
6+
":dependencyDashboard",
7+
":gitSignOff",
8+
":semanticCommitScopeDisabled",
9+
"schedule:earlyMondays"
10+
],
11+
"packageRules": [
12+
{
13+
"groupName": "dependencies",
14+
"matchUpdateTypes": [
15+
"major",
16+
"minor",
17+
"patch",
18+
"pin",
19+
"digest"
20+
]
21+
},
22+
{
23+
"enabled": false,
24+
"matchFileNames": [
25+
"Dockerfile"
26+
]
27+
},
28+
{
29+
"enabled": false,
30+
"matchFileNames": [
31+
".github/workflows/*.yaml"
32+
]
33+
}
34+
],
35+
"separateMajorMinor": false
36+
}

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2024-06-20T11:03:04Z by kres 4c9f215.
3+
# Generated on 2025-02-06T07:05:25Z by kres 987bf4d.
44

55
name: default
66
concurrency:
@@ -77,7 +77,7 @@ jobs:
7777
run: |
7878
make unit-tests-race
7979
- name: coverage
80-
uses: codecov/codecov-action@v4
80+
uses: codecov/codecov-action@v5
8181
with:
8282
files: _out/coverage-unit-tests.txt
8383
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/slack-notify.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2024-03-13T11:38:11Z by kres latest.
3+
# Generated on 2025-02-06T07:05:25Z by kres 987bf4d.
44

55
name: slack-notify
66
"on":
@@ -24,11 +24,12 @@ jobs:
2424
run: |
2525
echo pull_request_number=$(gh pr view -R ${{ github.repository }} ${{ github.event.workflow_run.head_repository.owner.login }}:${{ github.event.workflow_run.head_branch }} --json number --jq .number) >> $GITHUB_OUTPUT
2626
- name: Slack Notify
27-
uses: slackapi/slack-github-action@v1
27+
uses: slackapi/slack-github-action@v2
2828
with:
29-
channel-id: proj-talos-maintainers
29+
method: chat.postMessage
3030
payload: |
3131
{
32+
"channel": "proj-talos-maintainers",
3233
"attachments": [
3334
{
3435
"color": "${{ github.event.workflow_run.conclusion == 'success' && '#2EB886' || github.event.workflow_run.conclusion == 'failure' && '#A30002' || '#FFCC00' }}",
@@ -88,5 +89,4 @@ jobs:
8889
}
8990
]
9091
}
91-
env:
92-
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
92+
token: ${{ secrets.SLACK_BOT_TOKEN }}

.golangci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2024-06-20T11:03:04Z by kres 4c9f215.
3+
# Generated on 2025-02-06T07:05:25Z by kres 987bf4d.
44

55
# options for analysis running
66
run:
@@ -17,7 +17,6 @@ output:
1717
path: stdout
1818
print-issued-lines: true
1919
print-linter-name: true
20-
uniq-by-line: true
2120
path-prefix: ""
2221

2322
# all available settings of specific linters
@@ -116,7 +115,6 @@ linters:
116115
- gochecknoglobals
117116
- gochecknoinits
118117
- godox
119-
- gomnd
120118
- gomoddirectives
121119
- gosec
122120
- inamedparam
@@ -135,6 +133,7 @@ linters:
135133
- perfsprint # complains about us using fmt.Sprintf in non-performance critical code, updating just kres took too long
136134
- goimports # same as gci
137135
- musttag # seems to be broken - goes into imported libraries and reports issues there
136+
- exportloopref # WARN The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar.
138137

139138
issues:
140139
exclude: [ ]
@@ -144,6 +143,7 @@ issues:
144143
max-issues-per-linter: 10
145144
max-same-issues: 3
146145
new: false
146+
uniq-by-line: true
147147

148148
severity:
149149
default-severity: error

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
# syntax = docker/dockerfile-upstream:1.8.0-labs
1+
# syntax = docker/dockerfile-upstream:1.12.1-labs
22

33
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
44
#
5-
# Generated on 2024-06-20T11:03:04Z by kres 4c9f215.
5+
# Generated on 2025-02-06T07:05:25Z by kres 987bf4d.
66

77
ARG TOOLCHAIN
88

99
# cleaned up specs and compiled versions
1010
FROM scratch AS generate
1111

1212
# runs markdownlint
13-
FROM docker.io/oven/bun:1.1.13-alpine AS lint-markdown
13+
FROM docker.io/oven/bun:1.1.43-alpine AS lint-markdown
1414
WORKDIR /src
15-
RUN bun i markdownlint-cli@0.41.0 sentences-per-line@0.2.1
15+
RUN bun i markdownlint-cli@0.43.0 sentences-per-line@0.3.0
1616
COPY .markdownlint.json .
1717
COPY ./README.md ./README.md
18-
RUN bunx markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js .
18+
RUN bunx markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules sentences-per-line .
1919

2020
# base toolchain image
2121
FROM --platform=${BUILDPLATFORM} ${TOOLCHAIN} AS toolchain

Makefile

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
22
#
3-
# Generated on 2024-06-20T11:03:04Z by kres 4c9f215.
3+
# Generated on 2025-02-06T07:05:25Z by kres 987bf4d.
44

55
# common variables
66

@@ -17,15 +17,15 @@ WITH_RACE ?= false
1717
REGISTRY ?= ghcr.io
1818
USERNAME ?= siderolabs
1919
REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME)
20-
PROTOBUF_GO_VERSION ?= 1.34.2
21-
GRPC_GO_VERSION ?= 1.4.0
22-
GRPC_GATEWAY_VERSION ?= 2.20.0
20+
PROTOBUF_GO_VERSION ?= 1.36.2
21+
GRPC_GO_VERSION ?= 1.5.1
22+
GRPC_GATEWAY_VERSION ?= 2.25.1
2323
VTPROTOBUF_VERSION ?= 0.6.0
24-
GOIMPORTS_VERSION ?= 0.22.0
24+
GOIMPORTS_VERSION ?= 0.29.0
2525
DEEPCOPY_VERSION ?= v0.5.6
26-
GOLANGCILINT_VERSION ?= v1.59.1
27-
GOFUMPT_VERSION ?= v0.6.0
28-
GO_VERSION ?= 1.22.4
26+
GOLANGCILINT_VERSION ?= v1.63.4
27+
GOFUMPT_VERSION ?= v0.7.0
28+
GO_VERSION ?= 1.23.5
2929
GO_BUILDFLAGS ?=
3030
GO_LDFLAGS ?=
3131
CGO_ENABLED ?= 0
@@ -41,10 +41,12 @@ PLATFORM ?= linux/amd64
4141
PROGRESS ?= auto
4242
PUSH ?= false
4343
CI_ARGS ?=
44+
BUILDKIT_MULTI_PLATFORM ?=
4445
COMMON_ARGS = --file=Dockerfile
4546
COMMON_ARGS += --provenance=false
4647
COMMON_ARGS += --progress=$(PROGRESS)
4748
COMMON_ARGS += --platform=$(PLATFORM)
49+
COMMON_ARGS += --build-arg=BUILDKIT_MULTI_PLATFORM=$(BUILDKIT_MULTI_PLATFORM)
4850
COMMON_ARGS += --push=$(PUSH)
4951
COMMON_ARGS += --build-arg=ARTIFACTS="$(ARTIFACTS)"
5052
COMMON_ARGS += --build-arg=SHA="$(SHA)"
@@ -67,7 +69,7 @@ COMMON_ARGS += --build-arg=DEEPCOPY_VERSION="$(DEEPCOPY_VERSION)"
6769
COMMON_ARGS += --build-arg=GOLANGCILINT_VERSION="$(GOLANGCILINT_VERSION)"
6870
COMMON_ARGS += --build-arg=GOFUMPT_VERSION="$(GOFUMPT_VERSION)"
6971
COMMON_ARGS += --build-arg=TESTPKGS="$(TESTPKGS)"
70-
TOOLCHAIN ?= docker.io/golang:1.22-alpine
72+
TOOLCHAIN ?= docker.io/golang:1.23-alpine
7173

7274
# help menu
7375

@@ -143,8 +145,20 @@ clean: ## Cleans up all artifacts.
143145
target-%: ## Builds the specified target defined in the Dockerfile. The build result will only remain in the build cache.
144146
@$(BUILD) --target=$* $(COMMON_ARGS) $(TARGET_ARGS) $(CI_ARGS) .
145147

148+
registry-%: ## Builds the specified target defined in the Dockerfile and the output is an image. The image is pushed to the registry if PUSH=true.
149+
@$(MAKE) target-$* TARGET_ARGS="--tag=$(REGISTRY)/$(USERNAME)/$(IMAGE_NAME):$(IMAGE_TAG)" BUILDKIT_MULTI_PLATFORM=1
150+
146151
local-%: ## Builds the specified target defined in the Dockerfile using the local output type. The build result will be output to the specified local destination.
147152
@$(MAKE) target-$* TARGET_ARGS="--output=type=local,dest=$(DEST) $(TARGET_ARGS)"
153+
@PLATFORM=$(PLATFORM) DEST=$(DEST) bash -c '\
154+
for platform in $$(tr "," "\n" <<< "$$PLATFORM"); do \
155+
directory="$${platform//\//_}"; \
156+
if [[ -d "$$DEST/$$directory" ]]; then \
157+
echo $$platform; \
158+
mv -f "$$DEST/$$directory/"* $$DEST; \
159+
rmdir "$$DEST/$$directory/"; \
160+
fi; \
161+
done'
148162

149163
lint-golangci-lint: ## Runs golangci-lint linter.
150164
@$(MAKE) target-$@

controlplane/controlplane.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ package controlplane
88
import (
99
"fmt"
1010
"net"
11+
"slices"
1112
"strconv"
1213
"time"
1314

@@ -117,7 +118,7 @@ func (lb *LoadBalancer) Start(upstreamCh <-chan []string) error {
117118
for {
118119
select {
119120
case upstreams := <-upstreamCh:
120-
if err := lb.lb.ReconcileRoute(lb.endpoint, upstreams); err != nil {
121+
if err := lb.lb.ReconcileRoute(lb.endpoint, slices.Values(upstreams)); err != nil {
121122
lb.lb.Logger.Warn("failed reconciling list of upstreams",
122123
zap.Strings("upstreams", upstreams),
123124
zap.Error(err),
@@ -156,7 +157,7 @@ func findListenPort(address string) (int, error) {
156157
return 0, err
157158
}
158159

159-
port := l.Addr().(*net.TCPAddr).Port //nolint:forcetypeassert
160+
port := l.Addr().(*net.TCPAddr).Port //nolint:errcheck,forcetypeassert
160161

161162
return port, l.Close()
162163
}

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module github.com/siderolabs/go-loadbalancer
22

3-
go 1.22.1
3+
go 1.23.0
44

55
require (
6-
github.com/siderolabs/gen v0.5.0
6+
github.com/siderolabs/gen v0.8.0
77
github.com/siderolabs/go-retry v0.3.3
88
github.com/siderolabs/tcpproxy v0.1.0
9-
github.com/stretchr/testify v1.9.0
9+
github.com/stretchr/testify v1.10.0
1010
go.uber.org/goleak v1.3.0
1111
go.uber.org/zap v1.27.0
1212
)
@@ -15,7 +15,7 @@ require (
1515
github.com/davecgh/go-spew v1.1.1 // indirect
1616
github.com/pmezard/go-difflib v1.0.0 // indirect
1717
go.uber.org/multierr v1.11.0 // indirect
18-
golang.org/x/sys v0.21.0 // indirect
18+
golang.org/x/sys v0.30.0 // indirect
1919
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
2020
gopkg.in/yaml.v3 v3.0.1 // indirect
2121
)

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
99
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
1010
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1111
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
12-
github.com/siderolabs/gen v0.5.0 h1:Afdjx+zuZDf53eH5DB+E+T2JeCwBXGinV66A6osLgQI=
13-
github.com/siderolabs/gen v0.5.0/go.mod h1:1GUMBNliW98Xeq8GPQeVMYqQE09LFItE8enR3wgMh3Q=
12+
github.com/siderolabs/gen v0.8.0 h1:Pj93+hexkk5hQ7izjJ6YXnEWc8vlzOmDwFz13/VzS7o=
13+
github.com/siderolabs/gen v0.8.0/go.mod h1:an3a2Y53O7kUjnnK8Bfu3gewtvnIOu5RTU6HalFtXQQ=
1414
github.com/siderolabs/go-retry v0.3.3 h1:zKV+S1vumtO72E6sYsLlmIdV/G/GcYSBLiEx/c9oCEg=
1515
github.com/siderolabs/go-retry v0.3.3/go.mod h1:Ff/VGc7v7un4uQg3DybgrmOWHEmJ8BzZds/XNn/BqMI=
1616
github.com/siderolabs/tcpproxy v0.1.0 h1:IbkS9vRhjMOscc1US3M5P1RnsGKFgB6U5IzUk+4WkKA=
1717
github.com/siderolabs/tcpproxy v0.1.0/go.mod h1:onn6CPPj/w1UNqQ0U97oRPF0CqbrgEApYCw4P9IiCW8=
18-
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
19-
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
18+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
19+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
2020
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
2121
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
2222
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
2323
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
2424
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
2525
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
2626
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
27-
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
28-
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
27+
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
28+
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
2929
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3030
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
3131
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

0 commit comments

Comments
 (0)