diff --git a/.gitignore b/.gitignore index 1df644c..c6ef218 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -vendor -**/*.pb.go +.idea + diff --git a/Makefile b/Makefile index 6e78b17..76ee25b 100644 --- a/Makefile +++ b/Makefile @@ -1,36 +1,21 @@ -NETMAP_VERSION=v1.7.0 -GOGOPROTO_VERSION=v1.3.1 +#!/usr/bin/make -f +SHELL=bash -NETMAP_URL=https://github.com/nspcc-dev/netmap/archive/$(NETMAP_VERSION).tar.gz -GOGOPROTO_URL=https://github.com/gogo/protobuf/archive/$(GOGOPROTO_VERSION).tar.gz +# BRanch to match for BRaking changes +BRBR?=master -.PHONY: deps docgen - -deps: - @echo "⇒ Prepare" - @rm -rf ./vendor/github.com/gogo/protobuf - @rm -rf ./vendor/github.com/nspcc-dev/netmap - @mkdir -p ./vendor/github.com/gogo/protobuf - @mkdir -p ./vendor/github.com/nspcc-dev/netmap - - @echo "⇒ Download" - @curl -sL -o ./vendor/gogo.tar.gz $(GOGOPROTO_URL) - @curl -sL -o ./vendor/netmap.tar.gz $(NETMAP_URL) - - @echo "⇒ Vendoring" - @tar -xzf ./vendor/gogo.tar.gz --strip-components 1 -C ./vendor/github.com/gogo/protobuf - @tar -xzf ./vendor/netmap.tar.gz --strip-components 1 -C ./vendor/github.com/nspcc-dev/netmap - - @echo "⇒ Cleanup" - @rm ./vendor/gogo.tar.gz - @rm ./vendor/netmap.tar.gz +.PHONY: lint +lint: + buf check lint + buf check breaking --against-input '.git#branch=$(BRBR)' +.PHONY: doc # Regenerate documentation for protot files: -docgen: deps - @for f in `find . -type f -name '*.proto' -not -path './vendor/*' -exec dirname {} \; | sort -u `; do \ +doc: + @for f in `find . -type f -name '*.proto' -exec dirname {} \; | sort -u `; do \ echo "${B}${G}⇒ Documentation for $$(basename $$f) ${R}"; \ protoc \ --doc_opt=.github/markdown.tmpl,$${f}.md \ - --proto_path=.:./vendor:/usr/local/include \ + --proto_path=.:/usr/local/include \ --doc_out=proto-docs/ $${f}/*.proto; \ done diff --git a/buf.yaml b/buf.yaml new file mode 100644 index 0000000..2006bea --- /dev/null +++ b/buf.yaml @@ -0,0 +1,10 @@ +lint: + use: + - DEFAULT + - COMMENTS + - ENUM_FIRST_VALUE_ZERO + except: + - PACKAGE_DIRECTORY_MATCH + - PACKAGE_VERSION_SUFFIX + - ENUM_VALUE_PREFIX + - ENUM_ZERO_VALUE_SUFFIX