Skip to content

Commit

Permalink
*: remove gogoproto
Browse files Browse the repository at this point in the history
Signed-off-by: Giedrius Statkevičius <[email protected]>
  • Loading branch information
GiedriusS committed Nov 10, 2021
1 parent 9eceeea commit 6939b69
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 17 deletions.
8 changes: 7 additions & 1 deletion .bingo/Variables.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.4.3. DO NOT EDIT.
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.5.1. DO NOT EDIT.
# All tools are designed to be build inside $GOBIN.
BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
GOPATH ?= $(shell go env GOPATH)
Expand Down Expand Up @@ -129,6 +129,12 @@ $(PROMU): $(BINGO_DIR)/promu.mod
@echo "(re)installing $(GOBIN)/promu-v0.5.0"
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=promu.mod -o=$(GOBIN)/promu-v0.5.0 "github.com/prometheus/promu"

PROTOC_GEN_GO := $(GOBIN)/protoc-gen-go-v1.5.2
$(PROTOC_GEN_GO): $(BINGO_DIR)/protoc-gen-go.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/protoc-gen-go-v1.5.2"
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=protoc-gen-go.mod -o=$(GOBIN)/protoc-gen-go-v1.5.2 "github.com/golang/protobuf/protoc-gen-go"

PROTOC_GEN_GOGOFAST := $(GOBIN)/protoc-gen-gogofast-v1.3.2
$(PROTOC_GEN_GOGOFAST): $(BINGO_DIR)/protoc-gen-gogofast.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
Expand Down
5 changes: 5 additions & 0 deletions .bingo/protoc-gen-go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.17

require github.com/golang/protobuf v1.5.2 // protoc-gen-go
4 changes: 3 additions & 1 deletion .bingo/variables.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.4.3. DO NOT EDIT.
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.5.1. DO NOT EDIT.
# All tools are designed to be build inside $GOBIN.
# Those variables will work only until 'bingo get' was invoked, or if tools were installed via Makefile's Variables.mk.
GOBIN=${GOBIN:=$(go env GOBIN)}
Expand Down Expand Up @@ -44,6 +44,8 @@ PROMTOOL="${GOBIN}/promtool-v1.8.2-0.20200522113006-f4dd45609a05"

PROMU="${GOBIN}/promu-v0.5.0"

PROTOC_GEN_GO="${GOBIN}/protoc-gen-go-v1.5.2"

PROTOC_GEN_GOGOFAST="${GOBIN}/protoc-gen-gogofast-v1.3.2"

SHFMT="${GOBIN}/shfmt-v3.1.2"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ go-format: $(GOIMPORTS)
.PHONY: proto
proto: ## Generates Go files from Thanos proto files.
proto: check-git $(GOIMPORTS) $(PROTOC) $(PROTOC_GEN_GOGOFAST)
@GOIMPORTS_BIN="$(GOIMPORTS)" PROTOC_BIN="$(PROTOC)" PROTOC_GEN_GOGOFAST_BIN="$(PROTOC_GEN_GOGOFAST)" scripts/genproto.sh
@GOIMPORTS_BIN="$(GOIMPORTS)" PROTOC_BIN="$(PROTOC)" PROTOC_GEN_GOGOFAST_BIN="$(PROTOC_GEN_GOGOFAST)" PROTOC_GEN_GO_BIN="$(PROTOC_GEN_GO)" scripts/genproto.sh

.PHONY: tarballs-release
tarballs-release: ## Build tarballs.
Expand Down
2 changes: 1 addition & 1 deletion pkg/rules/rulespb/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "store/labelpb/types.proto";
//import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";

option go_package = "rulespb";
option go_package = "store/rulespb";

// option (gogoproto.sizer_all) = true;
// option (gogoproto.marshaler_all) = true;
Expand Down
4 changes: 2 additions & 2 deletions pkg/store/hintspb/hints.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package hintspb;
//import "gogoproto/gogo.proto";
import "store/storepb/types.proto";

option go_package = "hintspb";
option go_package = "store/hintspb";

// option (gogoproto.sizer_all) = true;
// option (gogoproto.marshaler_all) = true;
Expand Down Expand Up @@ -58,4 +58,4 @@ message LabelValuesRequestHints {
message LabelValuesResponseHints {
/// queried_blocks is the list of blocks that have been queried.
repeated Block queried_blocks = 1;
}
}
2 changes: 1 addition & 1 deletion pkg/store/labelpb/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
syntax = "proto3";
package thanos;

option go_package = "labelpb";
option go_package = "store/labelpb";

//import "gogoproto/gogo.proto";

Expand Down
2 changes: 1 addition & 1 deletion pkg/store/storepb/prompb/remote.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
syntax = "proto3";
package prometheus_copy;

option go_package = "prompb";
option go_package = "store/prompb";

import "store/storepb/prompb/types.proto";
//import "gogoproto/gogo.proto";
Expand Down
2 changes: 1 addition & 1 deletion pkg/store/storepb/prompb/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
syntax = "proto3";
package prometheus_copy;

option go_package = "prompb";
option go_package = "store/prompb";

//import "gogoproto/gogo.proto";
import "store/labelpb/types.proto";
Expand Down
2 changes: 1 addition & 1 deletion pkg/store/storepb/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "store/storepb/prompb/types.proto";
import "store/labelpb/types.proto";
import "google/protobuf/any.proto";

option go_package = "storepb";
option go_package = "store/storepb";

// option (gogoproto.sizer_all) = true;
// option (gogoproto.marshaler_all) = true;
Expand Down
4 changes: 2 additions & 2 deletions pkg/store/storepb/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
syntax = "proto3";
package thanos;

option go_package = "storepb";
option go_package = "store/storepb";

//import "gogoproto/gogo.proto";
import "store/labelpb/types.proto";
Expand Down Expand Up @@ -70,4 +70,4 @@ enum PartialResponseStrategy {
/// This is especially useful for any rule/alert evaluations on top of StoreAPI which usually does not tolerate partial
/// errors.
ABORT = 1;
}
}
1 change: 1 addition & 0 deletions pkg/targets/targetspb/rpc.pb.go

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

2 changes: 1 addition & 1 deletion pkg/targets/targetspb/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import "store/storepb/types.proto";
//import "gogoproto/gogo.proto";
import "store/labelpb/types.proto";
import "rules/rulespb/rpc.proto";
option go_package = "targetspb";
option go_package = "store/targetspb";

// option (gogoproto.sizer_all) = true;
// option (gogoproto.marshaler_all) = true;
Expand Down
13 changes: 9 additions & 4 deletions scripts/genproto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,22 @@ fi

mkdir -p /tmp/protobin/
cp ${PROTOC_GEN_GOGOFAST_BIN} /tmp/protobin/protoc-gen-gogofast
cp ${PROTOC_GEN_GO_BIN} /tmp/protobin/protoc-gen-go
PATH=${PATH}:/tmp/protobin
GOGOPROTO_ROOT="$(GO111MODULE=on go list -modfile=.bingo/protoc-gen-gogofast.mod -f '{{ .Dir }}' -m github.com/gogo/protobuf)"
GOPROTO_ROOT="$(GO111MODULE=on go list -modfile=.bingo/protoc-gen-go.mod -f '{{ .Dir }}' -m github.com/golang/protobuf)"

GOGOPROTO_PATH="${GOGOPROTO_ROOT}:${GOGOPROTO_ROOT}/protobuf"
GOPROTO_ROOT="${GOPROTO_ROOT}:${GOPROTO_ROOT}/protobuf"
echo "${GOPROTO_ROOT}!"

DIRS="store/storepb/ store/storepb/prompb/ store/labelpb rules/rulespb targets/targetspb store/hintspb queryfrontend metadata/metadatapb exemplars/exemplarspb info/infopb"
DIRS="store/storepb store/storepb/prompb/ store/labelpb rules/rulespb targets/targetspb store/hintspb queryfrontend metadata/metadatapb exemplars/exemplarspb info/infopb"
echo "generating code"
pushd "pkg"
for dir in ${DIRS}; do
${PROTOC_BIN} --gogofast_out=Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,plugins=grpc:. \
-I=. \
-I="${GOGOPROTO_PATH}" \
${PROTOC_BIN} --go_out=. \
-I=/home/giedrius/dev/thanos/proto/include/ \
-I=. \
${dir}/*.proto
protoc-go-inject-tag -input=${dir}/*pb.go

Expand Down

0 comments on commit 6939b69

Please sign in to comment.