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:
parent
843b10ed26
commit
811dc071aa
3
Makefile
3
Makefile
|
@ -28,6 +28,9 @@ protoc:
|
||||||
## ldconfig (may require sudo)
|
## ldconfig (may require sudo)
|
||||||
## https://stackoverflow.com/a/25518702
|
## https://stackoverflow.com/a/25518702
|
||||||
protoc $(INCLUDE) --gogo_out=plugins=grpc:. --lint_out=. types/*.proto
|
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:
|
install:
|
||||||
@ go install ./cmd/...
|
@ go install ./cmd/...
|
||||||
|
|
|
@ -40,6 +40,7 @@ It has these top-level messages:
|
||||||
Evidence
|
Evidence
|
||||||
KVPair
|
KVPair
|
||||||
*/
|
*/
|
||||||
|
//nolint: gas
|
||||||
package types
|
package types
|
||||||
|
|
||||||
import proto "github.com/gogo/protobuf/proto"
|
import proto "github.com/gogo/protobuf/proto"
|
||||||
|
|
Loading…
Reference in New Issue