Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions plugins/go-kratos/http/source.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source:
github:
owner: go-kratos
repository: kratos
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once a tagged release is available, this should update to use a goproxy source similar to https://github.com/bufbuild/plugins/blob/main/plugins/grpc/go/source.yaml.

2 changes: 2 additions & 0 deletions plugins/go-kratos/http/v2.9.2/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!Dockerfile
15 changes: 15 additions & 0 deletions plugins/go-kratos/http/v2.9.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# syntax=docker/dockerfile:1.17
FROM --platform=$BUILDPLATFORM golang:1.25.0-bookworm AS build

ARG TARGETOS TARGETARCH
ENV CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH

RUN --mount=type=cache,target=/go/pkg/mod \
go install -ldflags="-s -w" -trimpath go install github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@b9fab9a \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use a tagged version - it will require the upstream project to create a tag named cmd/protoc-gen-go-http/v2.X.Y (where X.Y are the minor/patch version).

See the grpc-go plugin for an example: https://github.com/grpc/grpc-go/releases/tag/cmd%2Fprotoc-gen-go-grpc%2Fv1.6.0

&& mv /go/bin/${GOOS}_${GOARCH}/protoc-gen-go-http /go/bin/protoc-gen-go-http || true

FROM scratch
COPY --from=build --link --chown=root:root /etc/passwd /etc/passwd
COPY --from=build --link --chown=root:root /go/bin/protoc-gen-go-http .
USER nobody
ENTRYPOINT [ "/protoc-gen-go-http" ]
8 changes: 8 additions & 0 deletions plugins/go-kratos/http/v2.9.2/buf.plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to be missing a few fields (like output_languages): https://github.com/bufbuild/plugins/blob/main/CONTRIBUTING.md#bufpluginyaml-file

Does it have dependencies on other generated code (like from protocolbuffers/go)? It would be good to verify if it works as a generated SDK. The general requirement is that the generated code outputs to a unique Go package (not to the same directory as protocolbuffers/go).

name: buf.build/community/kratos-http
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files for the plugin need to be moved to a corresponding directory under plugins - git mv plugins/go-kratos/http plugins/community/kratos-http.

plugin_version: v0.7.1
source_url: https://github.com/go-kratos/kratos/tree/main/cmd/protoc-gen-go-http
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We typically just use the top-level GitHub project URL in these files.

integration_guide_url: https://github.com/go-kratos/kratos#getting-started
description: A protoc plugin that generates Kratos HTTP server/client stubs and routing code from protobuf services annotated with HTTP options.
spdx_license_id: MIT
license_url: https://github.com/go-kratos/kratos/blob/main/LICENSE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These use the versioned URL in case things are moved around in the repository, however I don't see a corresponding tag in the source repo for the protoc-gen-go-http command (https://pkg.go.dev/github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2 is showing a v2 pseudo version).