Skip to content

Commit 2afd373

Browse files
authored
Merge pull request #1688 from felixfontein/protobuf
keyservice: update protobuf to a recent release, and make go code generation reproducible
2 parents 27dc305 + 062a60c commit 2afd373

File tree

5 files changed

+226
-333
lines changed

5 files changed

+226
-333
lines changed

Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ SYFT_VERSION ?= v0.87.0
2020
GORELEASER := $(BIN_DIR)/goreleaser
2121
GORELEASER_VERSION ?= v1.20.0
2222

23+
PROTOC_GO := $(BIN_DIR)/protoc-gen-go
24+
PROTOC_GO_VERSION ?= v1.35.2
25+
26+
PROTOC_GO_GRPC := $(BIN_DIR)/protoc-gen-go-grpc
27+
PROTOC_GO_GRPC_VERSION ?= v1.5.1
28+
2329
RSTCHECK := $(shell command -v rstcheck)
2430
MARKDOWNLINT := $(shell command -v mdl)
2531

@@ -74,11 +80,11 @@ showcoverage: test
7480
$(GO) tool cover -html=profile.out
7581

7682
.PHONY: generate
77-
generate: keyservice/keyservice.pb.go
83+
generate: install-protoc-go install-protoc-go-grpc keyservice/keyservice.pb.go
7884
$(GO) generate
7985

8086
%.pb.go: %.proto
81-
protoc --go_out=plugins=grpc:. $<
87+
protoc --plugin gen-go=$(PROTOC_GO) --plugin gen-go-grpc=$(PLUGIN_GO_GRPC) --go-grpc_opt=require_unimplemented_servers=false --go-grpc_out=. --go_out=. $<
8288

8389
.PHONY: functional-tests
8490
functional-tests:
@@ -112,6 +118,14 @@ install-goreleaser:
112118
install-syft:
113119
$(call go-install-tool,$(SYFT),github.com/anchore/syft/cmd/syft@$(SYFT_VERSION),$(SYFT_VERSION))
114120

121+
.PHONY: install-protoc-go
122+
install-protoc-go:
123+
$(call go-install-tool,$(PROTOC_GO),google.golang.org/protobuf/cmd/protoc-gen-go@$(PROTOC_GO_VERSION),$(PROTOC_GO_VERSION))
124+
125+
.PHONY: install-protoc-go-grpc
126+
install-protoc-go-grpc:
127+
$(call go-install-tool,$(PROTOC_GO_GRPC),google.golang.org/grpc/cmd/protoc-gen-go-grpc@$(PROTOC_GO_GRPC_VERSION),$(PROTOC_GO_GRPC_VERSION))
128+
115129
# go-install-tool will 'go install' any package $2 and install it to $1.
116130
define go-install-tool
117131
@[ -f $(1)-$(3) ] || { \

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ require (
2121
github.com/blang/semver v3.5.1+incompatible
2222
github.com/fatih/color v1.18.0
2323
github.com/getsops/gopgagent v0.0.0-20240527072608-0c14999532fe
24-
github.com/golang/protobuf v1.5.4
2524
github.com/google/go-cmp v0.6.0
2625
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
2726
github.com/goware/prefixer v0.0.0-20160118172347-395022866408

0 commit comments

Comments
 (0)