Skip to content

Commit ef47ec7

Browse files
author
Dmitriy Matrenichev
committed
chore: upgrade Codec implementations and usages to Codec2
This is breaking change, that (potentially) should lower the memory usage on our gRPC layer. Signed-off-by: Dmitriy Matrenichev <[email protected]>
1 parent ec3b59c commit ef47ec7

15 files changed

+200
-109
lines changed

.golangci.yml

Lines changed: 13 additions & 16 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-05-27T14:20:35Z by kres b5844f8.
3+
# Generated on 2024-10-10T19:23:45Z by kres 34e72ac.
44

55
# options for analysis running
66
run:
@@ -13,8 +13,8 @@ run:
1313
# output configuration options
1414
output:
1515
formats:
16-
- format: colored-line-number
17-
path: stdout
16+
- format: colored-line-number
17+
path: stdout
1818
print-issued-lines: true
1919
print-linter-name: true
2020
uniq-by-line: true
@@ -94,13 +94,15 @@ linters-settings:
9494
cyclop:
9595
# the maximal code complexity to report
9696
max-complexity: 20
97-
# depguard:
98-
# rules:
99-
# Main:
100-
# list-mode: lax
101-
# deny:
102-
# - pkg: github.com/OpenPeeDeeP/depguard
103-
# desc: this is just an example
97+
depguard:
98+
rules:
99+
prevent_unmaintained_packages:
100+
list-mode: lax # allow unless explicitly denied
101+
files:
102+
- $all
103+
deny:
104+
- pkg: io/ioutil
105+
desc: "replaced by io and os packages since Go 1.16: https://tip.golang.org/doc/go1.16#ioutil"
104106

105107
linters:
106108
enable-all: true
@@ -126,18 +128,13 @@ linters:
126128
- tagalign
127129
- tagliatelle
128130
- thelper
129-
- typecheck
130131
- varnamelen
131132
- wrapcheck
132-
- depguard # an Allow and/or Deny package list must be configured
133133
- testifylint # complains about our assert recorder and has a number of false positives for assert.Greater(t, thing, 1)
134134
- protogetter # complains about us using Value field on typed spec, instead of GetValue which has a different signature
135135
- perfsprint # complains about us using fmt.Sprintf in non-performance critical code, updating just kres took too long
136-
# abandoned linters for which golangci shows the warning that the repo is archived by the owner
137-
- execinquery
138-
# disabled as it seems to be broken - goes into imported libraries and reports issues there
139-
- musttag
140136
- goimports # same as gci
137+
- musttag # seems to be broken - goes into imported libraries and reports issues there
141138

142139
issues:
143140
exclude: [ ]

Dockerfile

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
# syntax = docker/dockerfile-upstream:1.7.1-labs
1+
# syntax = docker/dockerfile-upstream:1.10.0-labs
22

33
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
44
#
5-
# Generated on 2024-05-27T14:20:35Z by kres b5844f8.
5+
# Generated on 2024-10-10T19:23:45Z by kres 34e72ac.
66

77
ARG TOOLCHAIN
88

99
# runs markdownlint
10-
FROM docker.io/node:22.2.0-alpine3.19 AS lint-markdown
10+
FROM docker.io/oven/bun:1.1.29-alpine AS lint-markdown
1111
WORKDIR /src
12-
RUN npm i -g [email protected]
13-
12+
1413
COPY .markdownlint.json .
1514
COPY ./README.md ./README.md
16-
RUN markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js .
15+
RUN bunx markdownlint --ignore "CHANGELOG.md" --ignore "**/node_modules/**" --ignore '**/hack/chglog/**' --rules node_modules/sentences-per-line/index.js .
1716

1817
# collects proto specs
1918
FROM scratch AS proto-specs
@@ -25,14 +24,17 @@ RUN apk --update --no-cache add bash curl build-base protoc protobuf-dev
2524

2625
# build tools
2726
FROM --platform=${BUILDPLATFORM} toolchain AS tools
28-
ENV GO111MODULE on
27+
ENV GO111MODULE=on
2928
ARG CGO_ENABLED
30-
ENV CGO_ENABLED ${CGO_ENABLED}
29+
ENV CGO_ENABLED=${CGO_ENABLED}
3130
ARG GOTOOLCHAIN
32-
ENV GOTOOLCHAIN ${GOTOOLCHAIN}
31+
ENV GOTOOLCHAIN=${GOTOOLCHAIN}
3332
ARG GOEXPERIMENT
34-
ENV GOEXPERIMENT ${GOEXPERIMENT}
35-
ENV GOPATH /go
33+
ENV GOEXPERIMENT=${GOEXPERIMENT}
34+
ENV GOPATH=/go
35+
ARG GOIMPORTS_VERSION
36+
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install golang.org/x/tools/cmd/goimports@v${GOIMPORTS_VERSION}
37+
RUN mv /go/bin/goimports /bin
3638
ARG PROTOBUF_GO_VERSION
3739
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install google.golang.org/protobuf/cmd/protoc-gen-go@v${PROTOBUF_GO_VERSION}
3840
RUN mv /go/bin/protoc-gen-go /bin
@@ -42,9 +44,6 @@ RUN mv /go/bin/protoc-gen-go-grpc /bin
4244
ARG GRPC_GATEWAY_VERSION
4345
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION}
4446
RUN mv /go/bin/protoc-gen-grpc-gateway /bin
45-
ARG GOIMPORTS_VERSION
46-
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install golang.org/x/tools/cmd/goimports@v${GOIMPORTS_VERSION}
47-
RUN mv /go/bin/goimports /bin
4847
ARG DEEPCOPY_VERSION
4948
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \
5049
&& mv /go/bin/deep-copy /bin/deep-copy
@@ -85,7 +84,7 @@ RUN FILES="$(gofumpt -l .)" && test -z "${FILES}" || (echo -e "Source code is no
8584
FROM base AS lint-golangci-lint
8685
WORKDIR /src
8786
COPY .golangci.yml .
88-
ENV GOGC 50
87+
ENV GOGC=50
8988
RUN golangci-lint config verify --config .golangci.yml
9089
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/.cache/golangci-lint --mount=type=cache,target=/go/pkg golangci-lint run --config .golangci.yml
9190

Makefile

Lines changed: 9 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-05-27T14:20:53Z by kres b5844f8.
3+
# Generated on 2024-10-10T19:23:45Z by kres 34e72ac.
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.1
21-
GRPC_GO_VERSION ?= 1.3.0
22-
GRPC_GATEWAY_VERSION ?= 2.20.0
20+
PROTOBUF_GO_VERSION ?= 1.34.2
21+
GRPC_GO_VERSION ?= 1.5.1
22+
GRPC_GATEWAY_VERSION ?= 2.22.0
2323
VTPROTOBUF_VERSION ?= 0.6.0
24-
GOIMPORTS_VERSION ?= 0.21.0
24+
GOIMPORTS_VERSION ?= 0.25.0
2525
DEEPCOPY_VERSION ?= v0.5.6
26-
GOLANGCILINT_VERSION ?= v1.59.1
27-
GOFUMPT_VERSION ?= v0.6.0
28-
GO_VERSION ?= 1.22.3
26+
GOLANGCILINT_VERSION ?= v1.61.0
27+
GOFUMPT_VERSION ?= v0.7.0
28+
GO_VERSION ?= 1.23.2
2929
GO_BUILDFLAGS ?=
3030
GO_LDFLAGS ?=
3131
CGO_ENABLED ?= 0
@@ -67,7 +67,7 @@ COMMON_ARGS += --build-arg=DEEPCOPY_VERSION="$(DEEPCOPY_VERSION)"
6767
COMMON_ARGS += --build-arg=GOLANGCILINT_VERSION="$(GOLANGCILINT_VERSION)"
6868
COMMON_ARGS += --build-arg=GOFUMPT_VERSION="$(GOFUMPT_VERSION)"
6969
COMMON_ARGS += --build-arg=TESTPKGS="$(TESTPKGS)"
70-
TOOLCHAIN ?= docker.io/golang:1.22-alpine
70+
TOOLCHAIN ?= docker.io/golang:1.23-alpine
7171

7272
# help menu
7373

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ require (
66
github.com/golang/protobuf v1.5.4
77
github.com/hashicorp/go-multierror v1.1.1
88
github.com/stretchr/testify v1.9.0
9-
google.golang.org/grpc v1.64.0
10-
google.golang.org/protobuf v1.34.1
9+
google.golang.org/grpc v1.67.1
10+
google.golang.org/protobuf v1.35.1
1111
)
1212

1313
require (
1414
github.com/davecgh/go-spew v1.1.1 // indirect
1515
github.com/hashicorp/errwrap v1.1.0 // indirect
1616
github.com/pmezard/go-difflib v1.0.0 // indirect
17-
golang.org/x/net v0.25.0 // indirect
18-
golang.org/x/sys v0.20.0 // indirect
19-
golang.org/x/text v0.15.0 // indirect
20-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e // indirect
17+
golang.org/x/net v0.30.0 // indirect
18+
golang.org/x/sys v0.26.0 // indirect
19+
golang.org/x/text v0.19.0 // indirect
20+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect
2121
gopkg.in/yaml.v3 v3.0.1 // indirect
2222
)

go.sum

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek
44
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
55
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
66
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
7-
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
87
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
98
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
109
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -14,20 +13,20 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
1413
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1514
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
1615
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
17-
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
18-
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
19-
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
20-
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
21-
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
22-
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
23-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc=
24-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY=
25-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e h1:Elxv5MwEkCI9f5SkoL6afed6NTdxaGoAo39eANBwHL8=
26-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
27-
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
28-
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
29-
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
30-
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
16+
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
17+
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
18+
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
19+
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
20+
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
21+
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
22+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs=
23+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
24+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc=
25+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
26+
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
27+
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
28+
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
29+
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
3130
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
3231
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3332
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

hack/release.sh

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
44
#
5-
# Generated on 2022-06-06T17:35:55Z by kres 65530e7.
5+
# Generated on 2024-10-10T19:23:45Z by kres 34e72ac.
66

77
set -e
88

@@ -44,9 +44,92 @@ function commit {
4444
exit 1
4545
fi
4646

47+
if is_on_main_branch; then
48+
update_license_files
49+
fi
50+
4751
git commit -s -m "release($1): prepare release" -m "This is the official $1 release."
4852
}
4953

54+
function is_on_main_branch {
55+
main_remotes=("upstream" "origin")
56+
branch_names=("main" "master")
57+
current_branch=$(git rev-parse --abbrev-ref HEAD)
58+
59+
echo "Check current branch: $current_branch"
60+
61+
for remote in "${main_remotes[@]}"; do
62+
echo "Fetch remote $remote..."
63+
64+
if ! git fetch --quiet "$remote" &>/dev/null; then
65+
echo "Failed to fetch $remote, skip..."
66+
67+
continue
68+
fi
69+
70+
for branch_name in "${branch_names[@]}"; do
71+
if ! git rev-parse --verify "$branch_name" &>/dev/null; then
72+
echo "Branch $branch_name does not exist, skip..."
73+
74+
continue
75+
fi
76+
77+
echo "Branch $remote/$branch_name exists, comparing..."
78+
79+
merge_base=$(git merge-base "$current_branch" "$remote/$branch_name")
80+
latest_main=$(git rev-parse "$remote/$branch_name")
81+
82+
if [ "$merge_base" = "$latest_main" ]; then
83+
echo "Current branch is up-to-date with $remote/$branch_name"
84+
85+
return 0
86+
else
87+
echo "Current branch is not on $remote/$branch_name"
88+
89+
return 1
90+
fi
91+
done
92+
done
93+
94+
echo "No main or master branch found on any remote"
95+
96+
return 1
97+
}
98+
99+
function update_license_files {
100+
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
101+
parent_dir="$(dirname "$script_dir")"
102+
current_year=$(date +"%Y")
103+
change_date=$(date -v+4y +"%Y-%m-%d" 2>/dev/null || date -d "+4 years" +"%Y-%m-%d" 2>/dev/null || date --date="+4 years" +"%Y-%m-%d")
104+
105+
# Find LICENSE and .kres.yaml files recursively in the parent directory (project root)
106+
find "$parent_dir" \( -name "LICENSE" -o -name ".kres.yaml" \) -type f | while read -r file; do
107+
temp_file="${file}.tmp"
108+
109+
if [[ $file == *"LICENSE" ]]; then
110+
if grep -q "^Business Source License" "$file"; then
111+
sed -e "s/The Licensed Work is (c) [0-9]\{4\}/The Licensed Work is (c) $current_year/" \
112+
-e "s/Change Date: [0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/Change Date: $change_date/" \
113+
"$file" >"$temp_file"
114+
else
115+
continue # Not a Business Source License file
116+
fi
117+
elif [[ $file == *".kres.yaml" ]]; then
118+
sed -E 's/^([[:space:]]*)ChangeDate:.*$/\1ChangeDate: "'"$change_date"'"/' "$file" >"$temp_file"
119+
fi
120+
121+
# Check if the file has changed
122+
if ! cmp -s "$file" "$temp_file"; then
123+
mv "$temp_file" "$file"
124+
echo "Updated: $file"
125+
git add "$file"
126+
else
127+
echo "No changes: $file"
128+
rm "$temp_file"
129+
fi
130+
done
131+
}
132+
50133
if declare -f "$1" > /dev/null
51134
then
52135
cmd="$1"
@@ -55,7 +138,7 @@ then
55138
else
56139
cat <<EOF
57140
Usage:
58-
commit: Create the official release commit message.
141+
commit: Create the official release commit message (updates BUSL license dates if there is any).
59142
cherry-pick: Cherry-pick a commit into a release branch.
60143
changelog: Update the specified CHANGELOG.
61144
release-notes: Create release notes for GitHub release.

0 commit comments

Comments
 (0)