Skip to content

Commit

Permalink
Merge pull request #55 from bavix/nightly
Browse files Browse the repository at this point in the history
[2.2] Add imports github.com/googleapis/googleapis
  • Loading branch information
rez1dent3 committed Oct 11, 2023
2 parents e607798 + d33f5f0 commit bc938af
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
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

0 comments on commit bc938af

Please sign in to comment.