Skip to content

Commit

Permalink
refactor(gins): update import path and add CORS configuration support
Browse files Browse the repository at this point in the history
- Update ginsPackage import path from "github.com/origadmin/toolkits/runtime/kratos/transport/gins" to "github.com/origadmin/toolkits/runtime/transport/gins"
- Add CORS configuration support to the helloworld example
- Update buf.lock and buf.yaml files to include new dependencies
- Remove unused example.pb.go file
  • Loading branch information
godcong committed Nov 11, 2024
1 parent 1af00fa commit 1190720
Show file tree
Hide file tree
Showing 10 changed files with 227 additions and 371 deletions.
2 changes: 1 addition & 1 deletion cmd/protoc-gen-go-gins/gins.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
const (
contextPackage = protogen.GoImportPath("context")
ginPackage = protogen.GoImportPath("github.com/gin-gonic/gin")
ginsPackage = protogen.GoImportPath("github.com/origadmin/toolkits/runtime/kratos/transport/gins")
ginsPackage = protogen.GoImportPath("github.com/origadmin/toolkits/runtime/transport/gins")
bindingPackage = protogen.GoImportPath("github.com/go-kratos/kratos/v2/transport/http/binding")
//transportHTTPPackage = protogen.GoImportPath("github.com/go-kratos/kratos/v2/transport/http")
)
Expand Down
10 changes: 8 additions & 2 deletions examples/buf.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Generated by buf. DO NOT EDIT.
version: v2
deps:
- name: buf.build/bufbuild/protovalidate
commit: 5a7b106cbb87462d9a8c9ffecdbd2e38
digest: b5:0f2dc6c9453e9cc9e9f36807aaa5f94022e837d91fef4dcaeed79a35c0843cc64eba28ff077aab24da3b2cb12639ad256246f9f9a36c033b99d5754b19996b7e
- name: buf.build/googleapis/googleapis
commit: f52d4f76a8434cc5966798b1d3b4f110
digest: b5:5e634ff0ee118aea188b3e9c13ad7d285a192ef6c591bc20ff5a3360438d6ca310cfe9d663b20d60e1daa21789add35b919eac84e8e94a4d576e83a50dd2d62c
commit: 553fd4b4b3a640be9b69a3fa0c17b383
digest: b5:9e7cb39758f3487f0751765227dc0b9f0ef7a401ab37fa2e97c363446810f4bd0dca1f46dbb793a12d98c019f4028e48d0831b5cb3f09190f068ec1866c69c1d
- name: buf.build/origadmin/runtime
commit: 157d05fd7b25402aa7aa58ed28f7a3b6
digest: b5:333b207fe1af60e28ba0db9aac8526638fcec6baab132dd9e3ce1603078836f245946d544dca965cb839864172024db3dbfa4d013d0b10e26361df36a2e2803f
1 change: 1 addition & 0 deletions examples/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ breaking:
- FILE
deps:
- buf.build/googleapis/googleapis
- buf.build/origadmin/runtime
# - buf.build/envoyproxy/protoc-gen-validate
5 changes: 5 additions & 0 deletions examples/proto/helloworld/v1/helloworld.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

package helloworld.v1;

import "config/v1/cors.proto";
import "google/api/annotations.proto";

option go_package = "github.com/origadmin/toolkits/examples/services/helloworld/v1;helloworld";
Expand Down Expand Up @@ -29,3 +30,7 @@ message SayHelloRequest {
message SayHelloResponse {
string message = 1;
}

message ExampleCors {
config.v1.CorsConfig cors = 1;
}
92 changes: 73 additions & 19 deletions examples/services/helloworld/v1/helloworld.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

128 changes: 128 additions & 0 deletions examples/services/helloworld/v1/helloworld.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions examples/services/helloworld/v1/helloworld_gins.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1190720

Please sign in to comment.