-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This removes the deprecated gogo proto in favor of the standard implementation with the vtproto implementation for faster marshaling. The standard implementation still uses reflection and is slower than gogo, but gogo is deprecated due to the complexity of the code generation. vtproto is a project that does a similar thing to gogo but generates code in addition to the standard code generation rather than replacing it. Due to the exact bytes of the marshal changing, some test cases have changed their digests. The actual bytes should be wire compatible though even if they aren't the exact same bytes. Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
- Loading branch information
1 parent
43b9329
commit 2030300
Showing
24 changed files
with
2,150 additions
and
1,491 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
ARG GO_VERSION=1.21 | ||
ARG PROTOC_VERSION=3.11.4 | ||
|
||
FROM golang:${GO_VERSION} AS base | ||
|
||
FROM base AS protoc | ||
RUN apt-get update && apt-get --no-install-recommends install -y unzip | ||
ARG PROTOC_VERSION | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
RUN <<EOT | ||
set -e | ||
arch=$(echo $TARGETARCH | sed -e s/amd64/x86_64/ -e s/arm64/aarch_64/) | ||
wget -q https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-${TARGETOS}-${arch}.zip | ||
unzip protoc-${PROTOC_VERSION}-${TARGETOS}-${arch}.zip -d /opt/protoc | ||
rm -f /opt/protoc/readme.md | ||
EOT | ||
|
||
FROM base AS generate | ||
WORKDIR /app | ||
RUN --mount=type=bind,target=/app \ | ||
--mount=type=cache,target=/root/.cache \ | ||
--mount=type=cache,target=/go/pkg/mod \ | ||
go install \ | ||
github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto \ | ||
google.golang.org/protobuf/cmd/protoc-gen-go | ||
COPY --link --from=protoc /opt/protoc /usr/local | ||
COPY . /app/ | ||
RUN <<EOT | ||
set -e | ||
go generate -v ./... | ||
find . \( -type f -not -name '*.pb.go' -o -empty \) -delete | ||
EOT | ||
|
||
FROM scratch AS generated | ||
COPY --link --from=generate /app/ / |
Oops, something went wrong.