-
Notifications
You must be signed in to change notification settings - Fork 701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moved to buf; Added buf lint; Fixed ping service to match standards; … #383
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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.15 | ||
|
||
require github.com/bufbuild/buf v0.35.1 // cmd/buf |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,6 @@ MODULES ?= $(PROVIDER_MODULES) $(PWD)/ | |
|
||
GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin | ||
|
||
// TODO(bwplotka): Move to buf. | ||
PROTOC_VERSION ?= 3.12.3 | ||
PROTOC ?= $(GOBIN)/protoc-$(PROTOC_VERSION) | ||
TMP_GOPATH ?= /tmp/gopath | ||
|
||
GO111MODULE ?= on | ||
|
@@ -43,11 +40,6 @@ fmt: $(GOIMPORTS) | |
@echo "Running fmt for all modules: $(MODULES)" | ||
@$(GOIMPORTS) -local github.com/grpc-ecosystem/go-grpc-middleware/v2 -w $(MODULES) | ||
|
||
.PHONY: proto | ||
proto: ## Generates Go files from Thanos proto files. | ||
proto: $(GOIMPORTS) $(PROTOC) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC) ./grpctesting/testpb/test.proto | ||
@GOIMPORTS_BIN="$(GOIMPORTS)" PROTOC_BIN="$(PROTOC)" PROTOC_GEN_GO_BIN="$(PROTOC_GEN_GO)" PROTOC_GEN_GO_GRPC_BIN="$(PROTOC_GEN_GO_GRPC)" scripts/genproto.sh | ||
|
||
.PHONY: test | ||
test: | ||
@echo "Running tests for all modules: $(MODULES)" | ||
|
@@ -76,7 +68,9 @@ deps: | |
# --mem-profile-path string Path to memory profile output file | ||
# to debug big allocations during linting. | ||
lint: ## Runs various static analysis tools against our code. | ||
lint: fmt proto | ||
lint: $(BUF) fmt | ||
@echo ">> lint proto files" | ||
@$(BUF) lint | ||
@echo "Running lint for all modules: $(MODULES)" | ||
./scripts/git-tree.sh | ||
for dir in $(MODULES) ; do \ | ||
|
@@ -99,11 +93,21 @@ lint_module: $(FAILLINT) $(GOLANGCI_LINT) $(MISSPELL) | |
@cd $(DIR) && $(GOLANGCI_LINT) run | ||
@./scripts/git-tree.sh | ||
|
||
# TODO(bwplotka): Move to buf. | ||
$(PROTOC): | ||
|
||
# For protoc naming matters. | ||
PROTOC_GEN_GO_CURRENT := $(TMP_GOPATH)/protoc-gen-go | ||
PROTOC_GEN_GO_GRPC_CURRENT := $(TMP_GOPATH)/protoc-gen-go-grpc | ||
PROTO_TEST_DIR := testing/testpb/v1 | ||
|
||
.PHONY: proto | ||
proto: ## Generate testing protobufs | ||
proto: $(BUF) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC) $(PROTO_TEST_DIR)/test.proto | ||
Comment on lines
+103
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we have two targets name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can see this being confusing, but it's totally ok. It's to ensure |
||
@mkdir -p $(TMP_GOPATH) | ||
@echo ">> fetching protoc@${PROTOC_VERSION}" | ||
@PROTOC_VERSION="$(PROTOC_VERSION)" TMP_GOPATH="$(TMP_GOPATH)" scripts/installprotoc.sh | ||
@echo ">> installing protoc@${PROTOC_VERSION}" | ||
@mv -- "$(TMP_GOPATH)/bin/protoc" "$(GOBIN)/protoc-$(PROTOC_VERSION)" | ||
@echo ">> produced $(GOBIN)/protoc-$(PROTOC_VERSION)" | ||
@cp $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_CURRENT) | ||
@cp $(PROTOC_GEN_GO_GRPC) $(PROTOC_GEN_GO_GRPC_CURRENT) | ||
@echo ">> generating $(PROTO_TEST_DIR)" | ||
@PATH=$(GOBIN):$(TMP_GOPATH) $(BUF) protoc \ | ||
-I $(PROTO_TEST_DIR) \ | ||
--go_out=$(PROTO_TEST_DIR)/../ \ | ||
--go-grpc_out=$(PROTO_TEST_DIR)/../ \ | ||
$(PROTO_TEST_DIR)/*.proto | ||
Comment on lines
+109
to
+113
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is awesome, next step would be to just use version: v1beta1
plugins:
- name: go
out: testing/testpb/v1
- name: go-grpc
out: testing/testpb/v1 You may want There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. uuu nice, let's try it (or in sep PR) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: v1beta1 | ||
build: | ||
roots: | ||
- . | ||
lint: | ||
use: | ||
- DEFAULT |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we adding buf dependency? Wanted to know for info purpose 😛
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we use now buf as a tool! (: