protoc: "//nolint: gas" directive after pb generation (#164)

* protoc: "//nolint: gas" directive after pb generation

Fixes #138

Since we can't add package directives through the protoc
compiler, yet we need to "//nolint: gas" the Go generated
protobuf file, added a script whose purpose is to
go find the "package (\w+)$" declaration after go fmt
was run by protoc.

The competing solutions were more complex and can be
examined by visiting
https://github.com/tendermint/abci/issues/138#issuecomment-352226217

* simplify script

* rewrite script to work on Mac
This commit is contained in:
Emmanuel T Odeke 2017-12-19 11:29:59 -07:00 committed by Anton Kaliaev
parent 843b10ed26
commit 811dc071aa
2 changed files with 4 additions and 0 deletions

View File

@ -28,6 +28,9 @@ protoc:
## ldconfig (may require sudo)
## https://stackoverflow.com/a/25518702
protoc $(INCLUDE) --gogo_out=plugins=grpc:. --lint_out=. types/*.proto
@echo "--> adding nolint declarations to protobuf generated files"
@awk '/package types/ { print "//nolint: gas"; print; next }1' types/types.pb.go > types/types.pb.go.new
@mv types/types.pb.go.new types/types.pb.go
install:
@ go install ./cmd/...

View File

@ -40,6 +40,7 @@ It has these top-level messages:
Evidence
KVPair
*/
//nolint: gas
package types
import proto "github.com/gogo/protobuf/proto"