Skip to content

Commit

Permalink
Upgraded proto related deps: grpc and protobuf; removed gogo from core.
Browse files Browse the repository at this point in the history
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
  • Loading branch information
yashrsharma44 authored and bwplotka committed Jan 17, 2021
1 parent 08b17eb commit e83983b
Show file tree
Hide file tree
Showing 40 changed files with 1,120 additions and 1,794 deletions.
3 changes: 2 additions & 1 deletion .bingo/README.md
Expand Up @@ -5,7 +5,8 @@ This is directory which stores Go modules with pinned buildable package that is
* Run `bingo get` to install all tools having each own module file in this directory.
* Run `bingo get <tool>` to install <tool> that have own module file in this directory.
* For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use $(<upper case tool name>) variable where <tool> is the .bingo/<tool>.mod.
* For shell: Run `source .bingo/variables.env` to source all environment variable for each tool
* For shell: Run `source .bingo/variables.env` to source all environment variable for each tool.
* For go: Import `.bingo/variables.go` to for variable names.
* See https://github.com/bwplotka/bingo or -h on how to add, remove or change binaries dependencies.

## Requirements
Expand Down
41 changes: 24 additions & 17 deletions .bingo/Variables.mk
@@ -1,5 +1,6 @@
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.2.2. DO NOT EDIT.
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.3.0. DO NOT EDIT.
# All tools are designed to be build inside $GOBIN.
BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
GOPATH ?= $(shell go env GOPATH)
GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin
GO ?= $(shell which go)
Expand All @@ -16,39 +17,45 @@ GO ?= $(shell which go)
# @echo "Running bingo"
# @$(BINGO) <flags/args..>
#
BINGO := $(GOBIN)/bingo-v0.2.2
$(BINGO): .bingo/bingo.mod
BINGO := $(GOBIN)/bingo-v0.3.0
$(BINGO): $(BINGO_DIR)/bingo.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)/bingo-v0.2.2"
@cd .bingo && $(GO) build -modfile=bingo.mod -o=$(GOBIN)/bingo-v0.2.2 "github.com/bwplotka/bingo"
@echo "(re)installing $(GOBIN)/bingo-v0.3.0"
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=bingo.mod -o=$(GOBIN)/bingo-v0.3.0 "github.com/bwplotka/bingo"

FAILLINT := $(GOBIN)/faillint-v1.5.0
$(FAILLINT): .bingo/faillint.mod
$(FAILLINT): $(BINGO_DIR)/faillint.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)/faillint-v1.5.0"
@cd .bingo && $(GO) build -modfile=faillint.mod -o=$(GOBIN)/faillint-v1.5.0 "github.com/fatih/faillint"
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=faillint.mod -o=$(GOBIN)/faillint-v1.5.0 "github.com/fatih/faillint"

GOIMPORTS := $(GOBIN)/goimports-v0.0.0-20200529172331-a64b76657301
$(GOIMPORTS): .bingo/goimports.mod
$(GOIMPORTS): $(BINGO_DIR)/goimports.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)/goimports-v0.0.0-20200529172331-a64b76657301"
@cd .bingo && $(GO) build -modfile=goimports.mod -o=$(GOBIN)/goimports-v0.0.0-20200529172331-a64b76657301 "golang.org/x/tools/cmd/goimports"
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=goimports.mod -o=$(GOBIN)/goimports-v0.0.0-20200529172331-a64b76657301 "golang.org/x/tools/cmd/goimports"

GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.27.0
$(GOLANGCI_LINT): .bingo/golangci-lint.mod
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.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)/golangci-lint-v1.27.0"
@cd .bingo && $(GO) build -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.27.0 "github.com/golangci/golangci-lint/cmd/golangci-lint"
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=golangci-lint.mod -o=$(GOBIN)/golangci-lint-v1.27.0 "github.com/golangci/golangci-lint/cmd/golangci-lint"

MISSPELL := $(GOBIN)/misspell-v0.3.4
$(MISSPELL): .bingo/misspell.mod
$(MISSPELL): $(BINGO_DIR)/misspell.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)/misspell-v0.3.4"
@cd .bingo && $(GO) build -modfile=misspell.mod -o=$(GOBIN)/misspell-v0.3.4 "github.com/client9/misspell/cmd/misspell"
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=misspell.mod -o=$(GOBIN)/misspell-v0.3.4 "github.com/client9/misspell/cmd/misspell"

PROTOC_GEN_GOGOFAST := $(GOBIN)/protoc-gen-gogofast-v1.3.1
$(PROTOC_GEN_GOGOFAST): .bingo/protoc-gen-gogofast.mod
PROTOC_GEN_GO_GRPC := $(GOBIN)/protoc-gen-go-grpc-v0.0.0-20200723182653-9106c3fff523
$(PROTOC_GEN_GO_GRPC): $(BINGO_DIR)/protoc-gen-go-grpc.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-gogofast-v1.3.1"
@cd .bingo && $(GO) build -modfile=protoc-gen-gogofast.mod -o=$(GOBIN)/protoc-gen-gogofast-v1.3.1 "github.com/gogo/protobuf/protoc-gen-gogofast"
@echo "(re)installing $(GOBIN)/protoc-gen-go-grpc-v0.0.0-20200723182653-9106c3fff523"
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=protoc-gen-go-grpc.mod -o=$(GOBIN)/protoc-gen-go-grpc-v0.0.0-20200723182653-9106c3fff523 "google.golang.org/grpc/cmd/protoc-gen-go-grpc"

PROTOC_GEN_GO := $(GOBIN)/protoc-gen-go-v1.25.0
$(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.25.0"
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=protoc-gen-go.mod -o=$(GOBIN)/protoc-gen-go-v1.25.0 "google.golang.org/protobuf/cmd/protoc-gen-go"

2 changes: 1 addition & 1 deletion .bingo/bingo.mod
Expand Up @@ -2,4 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.14

require github.com/bwplotka/bingo v0.2.2
require github.com/bwplotka/bingo v0.3.0
5 changes: 1 addition & 4 deletions .bingo/golangci-lint.mod
Expand Up @@ -2,7 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.14

require (
github.com/golangci/golangci-lint v1.27.0 // cmd/golangci-lint
github.com/securego/gosec v0.0.0-20200316084457-7da9f46445fd // indirect
)
require github.com/golangci/golangci-lint v1.27.0 // cmd/golangci-lint
5 changes: 5 additions & 0 deletions .bingo/protoc-gen-go-grpc.mod
@@ -0,0 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.14

require google.golang.org/grpc/cmd/protoc-gen-go-grpc v0.0.0-20200723182653-9106c3fff523
Expand Up @@ -2,4 +2,4 @@ module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT

go 1.14

require github.com/gogo/protobuf v1.3.1 // protoc-gen-gogofast
require google.golang.org/protobuf v1.25.0 // cmd/protoc-gen-go
22 changes: 12 additions & 10 deletions .bingo/variables.env
@@ -1,22 +1,24 @@
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.2.2. DO NOT EDIT.
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.3.0. 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.
local gobin=$(go env GOBIN)
GOBIN=${GOBIN:=$(go env GOBIN)}

if [ -z "$gobin" ]; then
gobin="$(go env GOPATH)/bin"
if [ -z "$GOBIN" ]; then
GOBIN="$(go env GOPATH)/bin"
fi


BINGO="${gobin}/bingo-v0.2.2"
BINGO="${GOBIN}/bingo-v0.3.0"

FAILLINT="${gobin}/faillint-v1.5.0"
FAILLINT="${GOBIN}/faillint-v1.5.0"

GOIMPORTS="${gobin}/goimports-v0.0.0-20200529172331-a64b76657301"
GOIMPORTS="${GOBIN}/goimports-v0.0.0-20200529172331-a64b76657301"

GOLANGCI_LINT="${gobin}/golangci-lint-v1.27.0"
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.27.0"

MISSPELL="${gobin}/misspell-v0.3.4"
MISSPELL="${GOBIN}/misspell-v0.3.4"

PROTOC_GEN_GOGOFAST="${gobin}/protoc-gen-gogofast-v1.3.1"
PROTOC_GEN_GO_GRPC="${GOBIN}/protoc-gen-go-grpc-v0.0.0-20200723182653-9106c3fff523"

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

3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -201,4 +201,5 @@ coverage.txt
#vendor
vendor/

.envrc
.envrc
.bin
43 changes: 30 additions & 13 deletions Makefile
Expand Up @@ -2,16 +2,16 @@ include .bingo/Variables.mk

SHELL=/bin/bash

PROVIDER_MODULES ?= $(shell ls -d $(PWD)/providers/*)
PROVIDER_MODULES ?= $(shell find $(PWD)/providers/ -name "go.mod" | grep -v ".bingo" | xargs dirname)
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
export GO111MODULE
GOPROXY ?= https://proxy.golang.org
Expand Down Expand Up @@ -45,8 +45,8 @@ fmt: $(GOIMPORTS)

.PHONY: proto
proto: ## Generates Go files from Thanos proto files.
proto: $(GOIMPORTS) $(PROTOC) $(PROTOC_GEN_GOGOFAST) ./grpctesting/testpb/test.proto
@GOIMPORTS_BIN="$(GOIMPORTS)" PROTOC_BIN="$(PROTOC)" PROTOC_GEN_GOGOFAST_BIN="$(PROTOC_GEN_GOGOFAST)" scripts/genproto.sh
proto: $(GOIMPORTS) $(PROTOC) $(PROTOC_GEN_GOGOFAST) $(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)" PROTOC_GEN_GOGOFAST_BIN="$(PROTOC_GEN_GOGOFAST)" scripts/genproto.sh

.PHONY: test
test:
Expand All @@ -61,27 +61,44 @@ test_module:
@echo "Running tests for dir: $(DIR)"
cd $(DIR) && go test -v -race ./...

.PHONY: deps
deps:
@echo "Running deps tidy for all modules: $(MODULES)"
for dir in $(MODULES) ; do \
cd $${dir} && go mod tidy; \
done

.PHONY: lint
# PROTIP:
# Add
# --cpu-profile-path string Path to CPU profile output file
# --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 $(FAILLINT) $(GOLANGCI_LINT) $(MISSPELL)
lint: fmt proto
@echo "Running lint for all modules: $(MODULES)"
./scripts/git-tree.sh
for dir in $(MODULES) ; do \
$(MAKE) lint_module DIR=$${dir} ; \
done

.PHONY: lint_module
# PROTIP:
# Add
# --cpu-profile-path string Path to CPU profile output file
# --mem-profile-path string Path to memory profile output file
# to debug big allocations during linting.
lint_module: ## Runs various static analysis against our code.
lint_module: $(FAILLINT) $(GOLANGCI_LINT) $(MISSPELL)
@echo ">> verifying modules being imported"
@$(FAILLINT) -paths "errors=github.com/pkg/errors,fmt.{Print,Printf,Println}" ./...
@cd $(DIR) && $(FAILLINT) -paths "errors=github.com/pkg/errors,fmt.{Print,Printf,Println}" ./...
@echo ">> examining all of the Go files"
@go vet -stdmethods=false ./...
@cd $(DIR) && go vet -stdmethods=false ./...
@echo ">> linting all of the Go files GOGC=${GOGC}"
@$(GOLANGCI_LINT) run
@echo ">> detecting misspells"
@find . -type f | grep -v vendor/ | grep -vE '\./\..*' | xargs $(MISSPELL) -error
@echo ">> ensuring generated proto files are up to date"
@$(MAKE) proto
./scripts/git-tree.sh
@cd $(DIR) && $(GOLANGCI_LINT) run
@./scripts/git-tree.sh

# TODO(bwplotka): Move to buf.
$(PROTOC):
@mkdir -p $(TMP_GOPATH)
@echo ">> fetching protoc@${PROTOC_VERSION}"
Expand Down
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -57,6 +57,7 @@ myServer := grpc.NewServer(
* [`auth`](auth) - a customizable (via `AuthFunc`) piece of auth middleware

#### Logging

* [`tags`](interceptors/tags) - a library that adds a `Tag` map to context, with data populated from request body
* [`zap`](providers/zap) - integration of [zap](https://github.com/uber-go/zap) logging library into gRPC handlers.
* [`logrus`](providers/logrus) - integration of [logrus](https://github.com/sirupsen/logrus) logging library into gRPC handlers.
Expand Down
11 changes: 6 additions & 5 deletions go.mod
Expand Up @@ -3,13 +3,14 @@ module github.com/grpc-ecosystem/go-grpc-middleware/v2
go 1.14

require (
github.com/gogo/protobuf v1.2.1
github.com/golang/protobuf v1.3.2
github.com/golang/protobuf v1.4.3
github.com/opentracing/opentracing-go v1.1.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.4.0
github.com/stretchr/testify v1.7.0
golang.org/x/net v0.0.0-20190620200207-3b0461eec859
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect
google.golang.org/grpc v1.19.0
google.golang.org/grpc v1.30.1
google.golang.org/grpc/examples v0.0.0-20200723182653-9106c3fff523
google.golang.org/protobuf v1.25.0 // Github link: https://github.com/protocolbuffers/protobuf-go.

)

0 comments on commit e83983b

Please sign in to comment.