Skip to content

Commit

Permalink
rename api.proto files to avoid namespace collision warning
Browse files Browse the repository at this point in the history
It seems like a proto library problem that we were getting these
warnings, but we were.

See golang/protobuf#1122 for more details. At
the time of this commit that issue is still open, but since I'm renaming
the files it should fix our problem.
  • Loading branch information
bretmckee committed Apr 11, 2023
1 parent 9bffa47 commit c27576f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ grpc-tools:
%.pb.gw.go: proto/%.proto
${PROTOC} -I "$(<D)" -I "${ANNOTATIONS_DIR}" --grpc-gateway_out="$(@D)" --grpc-gateway_opt=logtostderr=true --grpc-gateway_opt=paths=source_relative $<

.PHONY: frontend-generated
frontend-generated: frontend/api/api.pb.go frontend/api/api_grpc.pb.go frontend/api/api.pb.gw.go
.PHONY: frontend-api
frontend-api: frontend/frontendapi/frontend_api.pb.go frontend/frontendapi/frontend_api_grpc.pb.go frontend/frontendapi/frontend_api.pb.gw.go

.PHONY: backend-generated
backend-generated: backend/api/api.pb.go backend/api/api_grpc.pb.go backend/api/api.pb.gw.go
.PHONY: backend-api
backend-api: backend/backendapi/backend_api.pb.go backend/backendapi/backend_api_grpc.pb.go backend/backendapi/backend_api.pb.gw.go

.PHONY: generated
generated: frontend-generated backend-generated
.PHONY: api
api: frontend-api backend-api

.PHONY: clean
clean:
rm frontend/api/*.go backend/api/*.go

.PHONY: $(CONTAINERS)
$(CONTAINERS): generated
$(CONTAINERS): api
docker build -f Dockerfile -t $@:dev --build-arg TARGET=$@ .
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";
package github.com.bretmckee.microservice.backend.api;
option go_package = "github.com/bretmckee/microservice/backend/api";
package github.com.bretmckee.microservice.backend.backendapi;
option go_package = "github.com/bretmckee/microservice/backend/backendapi";

import "google/api/annotations.proto";

Expand Down
2 changes: 1 addition & 1 deletion backend/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"os"
"strings"

pb "github.com/bretmckee/microservice/backend/api"
pb "github.com/bretmckee/microservice/backend/backendapi"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"google.golang.org/grpc"
Expand Down
4 changes: 2 additions & 2 deletions frontend/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"strings"
"time"

backend "github.com/bretmckee/microservice/backend/api"
pb "github.com/bretmckee/microservice/frontend/api"
backend "github.com/bretmckee/microservice/backend/backendapi"
pb "github.com/bretmckee/microservice/frontend/frontendapi"
"github.com/golang/protobuf/proto"
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
"google.golang.org/grpc"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax = "proto3";
package github.com.bretmckee.microservice.frontend.api;
option go_package = "github.com/bretmckee/microservice/frontend/api";
package github.com.bretmckee.microservice.frontend.frontendapi;
option go_package = "github.com/bretmckee/microservice/frontend/frontendapi";

import "google/api/annotations.proto";

Expand Down

0 comments on commit c27576f

Please sign in to comment.