Skip to content

Commit

Permalink
fix panic in nil messages
Browse files Browse the repository at this point in the history
  • Loading branch information
drewwells committed Feb 9, 2024
1 parent 03a8b9b commit 41908d6
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 194 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ trigger-travis.sh
.idea

/protoc-gen-gorm
/.gentool
37 changes: 27 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ test: build

regenerate: clean-gen generate

clean:
rm -rf .gentool

clean-gen:
cd example/postgres_arrays && rm -f *.pb.gorm.go && rm -f *.pb.go
cd example/user && rm -f *.pb.gorm.go && rm -f *.pb.go
Expand Down Expand Up @@ -45,9 +48,12 @@ example/postgres_arrays/*.pb.go: example/postgres_arrays/*.proto
install:
go install -v .

gentool:
gentool: .gentool

.gentool:
docker build -f docker/Dockerfile -t $(GENTOOL_IMAGE) .
docker image prune -f --filter label=stage=server-intermediate
touch $@

generate-gentool: SRCROOT_ON_HOST := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
generate-gentool: SRCROOT_IN_CONTAINER := /go/src/$(PROJECT_ROOT)
Expand All @@ -59,20 +65,28 @@ generate-gentool: GENERATOR := $(DOCKER_RUNNER) $(DOCKER_GENERATOR)
generate-gentool: gentool
$(DOCKER_RUNNER) \
$(GENTOOL_IMAGE) \
--go_out="plugins=grpc:$(DOCKERPATH)" \
--go_out="$(DOCKERPATH)" \
--go-grpc_out="$(DOCKERPATH)" \
--validate_out="lang=go:$(DOCKERPATH)" \
--gorm_out="engine=postgres,enums=string,gateway:$(DOCKERPATH)" \
feature_demo/demo_multi_file.proto \
feature_demo/demo_multi_file_service.proto \
feature_demo/demo_service.proto \
feature_demo/demo_types.proto
feature_demo/demo_multi_file.proto \
feature_demo/demo_multi_file_service.proto \
feature_demo/demo_service.proto \
feature_demo/demo_types.proto

$(DOCKER_RUNNER) \
$(GENTOOL_IMAGE) \
--go_out="plugins=grpc:$(DOCKERPATH)" \
--go_out="$(DOCKERPATH)" \
--go-grpc_out="$(DOCKERPATH)" \
--validate_out="lang=go:$(DOCKERPATH)" \
--gorm_out="engine=postgres,enums=string,gateway:$(DOCKERPATH)" \
user/user.proto

$(DOCKER_RUNNER) \
$(GENTOOL_IMAGE) \
--go_out="plugins=grpc:$(DOCKERPATH)" \
--go_out="$(DOCKERPATH)" \
--go-grpc_out="$(DOCKERPATH)" \
--validate_out="lang=go:$(DOCKERPATH)" \
--gorm_out="engine=postgres,enums=string,gateway:$(DOCKERPATH)" \
postgres_arrays/postgres_arrays.proto

Expand All @@ -83,8 +97,11 @@ build-local:
protoc --proto_path . \
-I./proto/ \
-I./third_party/proto/ \
-I=. example/feature_demo/demo_multi_file.proto \
example/feature_demo/demo_service.proto --gorm_out="engine=postgres,enums=string,gateway:./example/feature_demo" --go_out=./example/feature_demo
-I=. \
example/feature_demo/demo_multi_file.proto \
example/feature_demo/demo_service.proto \
--gorm_out="engine=postgres,enums=string,gateway:./example/feature_demo" \
--go_out=./example/feature_demo

build-user-local:
rm -rf example/user/github.com/
Expand Down
3 changes: 3 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ ENTRYPOINT ["protoc", "-I.", \
"-Igithub.com/mwitkow/go-proto-validators", \
# required import paths for protoc-gen-gorm plugin, Should add /proto path once updated
"-Igithub.com/infobloxopen/protoc-gen-gorm", \
"-Igithub.com/infobloxopen/protoc-gen-gorm/proto", \
# required import paths for protoc-gen-atlas-query-validate plugin
"-Igithub.com/infobloxopen/protoc-gen-atlas-query-validate", \
# required import paths for protoc-gen-preprocess plugin
"-Igithub.com/infobloxopen/protoc-gen-preprocess", \
"-Igithub.com/infobloxopen/protoc-gen-gorm/example", \
"-Igithub.com/infobloxopen/protoc-gen-gorm/third_party/proto", \
# required import paths for protoc-gen-atlas-validate plugin
"-Igithub.com/infobloxopen/protoc-gen-atlas-validate" \
]
4 changes: 2 additions & 2 deletions example/feature_demo/demo_multi_file.pb.go

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

4 changes: 2 additions & 2 deletions example/feature_demo/demo_multi_file_service.pb.go

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

12 changes: 4 additions & 8 deletions example/feature_demo/demo_multi_file_service_grpc.pb.go

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

4 changes: 2 additions & 2 deletions example/feature_demo/demo_service.pb.go

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

Loading

0 comments on commit 41908d6

Please sign in to comment.