Skip to content
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

[2.2] Add imports github.com/googleapis/googleapis #55

Merged
merged 4 commits into from
Oct 11, 2023
Merged
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
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
assets
deployments
.git
.github
*.pb.go
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ RUN apk -U --no-cache add bash git protobuf curl &&\
go install -v google.golang.org/protobuf/cmd/protoc-gen-go@latest &&\
go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest &&\
# cloning well-known-types
# only use needed files
git clone --depth=1 https://github.com/protocolbuffers/protobuf.git /protobuf-repo &&\
mv /protobuf-repo/src/ /protobuf/ &&\
rm -rf /protobuf-repo &&\
# cloning googleapis-types
git clone --depth=1 https://github.com/googleapis/googleapis.git /googleapis &&\
# cleanup
rm -rf /protobuf-repo &&\
find /protobuf -not -name "*.proto" -type f -delete &&\
apk del git &&\
apk -v cache clean
Expand Down
8 changes: 7 additions & 1 deletion example/well_known_types/wkt.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

package well_known_types;

import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/api.proto";

Expand All @@ -10,5 +11,10 @@ service Gripmock {
// this shows us example on using WKT as dependency
// api.proto in particular has go_package alias with semicolon
// "google.golang.org/genproto/protobuf/api;api"
rpc ApiInfo(google.protobuf.Empty) returns (google.protobuf.Api);
rpc ApiInfo(google.protobuf.Empty) returns (google.protobuf.Api) {
option (google.api.http) = {
post: "/v1/gripmock/api-info"
body: "*"
};
}
}
2 changes: 1 addition & 1 deletion gripmock.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func main() {
adminport := flag.String("admin-port", "4771", "Port of stub admin server")
adminBindAddr := flag.String("admin-listen", "0.0.0.0", "Adress the admin server will bind to. Default to localhost, set to 0.0.0.0 to use from another machine")
stubPath := flag.String("stub", "", "Path where the stub files are (Optional)")
imports := flag.String("imports", "/protobuf", "comma separated imports path. default path /protobuf is where gripmock Dockerfile install WKT protos")
imports := flag.String("imports", "/protobuf,/googleapis", "comma separated imports path. default path /protobuf,/googleapis is where gripmock Dockerfile install WKT protos")
// for backwards compatibility
if os.Args[1] == "gripmock" {
os.Args = append(os.Args[:1], os.Args[2:]...)
Expand Down