-
Notifications
You must be signed in to change notification settings - Fork 19
feat(plugins): add kratos-http community plugin for v2.9.2 #2164
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
base: main
Are you sure you want to change the base?
Conversation
pkwarren
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution. It looks like there are some changes needed in the go-kratos project in order to adopt this.
After moving the plugin to the correct location, you can test building the plugin with make test PLUGINS=community/kratos-http. The first time this runs it will create plugin.sum files used to verify deterministic output from the plugin. These will need to be checked in to get the build passing. See https://github.com/bufbuild/plugins/blob/main/CONTRIBUTING.md#creating-a-new-plugin for more information.
| @@ -0,0 +1,8 @@ | |||
| version: v1 | |||
| name: buf.build/community/kratos-http | |||
There was a problem hiding this comment.
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.
| version: v1 | ||
| name: buf.build/community/kratos-http | ||
| plugin_version: v0.7.1 | ||
| source_url: https://github.com/go-kratos/kratos/tree/main/cmd/protoc-gen-go-http |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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).
| 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 \ |
There was a problem hiding this comment.
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
| source: | ||
| github: | ||
| owner: go-kratos | ||
| repository: kratos |
There was a problem hiding this comment.
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.
| @@ -0,0 +1,8 @@ | |||
| version: v1 | |||
There was a problem hiding this comment.
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).
No description provided.