frostfs-api-go-pogpp/Makefile
Evgeniy Kulikov 04a5b80550
docs: prepare template and gen make command
- add markdown simple template
- add Makefile `docgen` command
2019-11-20 18:56:35 +03:00

37 lines
1.2 KiB
Makefile

B=\033[0;1m
G=\033[0;92m
R=\033[0m
# Reformat code
format:
@[ ! -z `which goimports` ] || (echo "install goimports" && exit 2)
@for f in `find . -type f -name '*.go' -not -path './vendor/*' -not -name '*.pb.go' -prune`; do \
echo "${B}${G}⇒ Processing $$f ${R}"; \
goimports -w $$f; \
done
# Regenerate documentation for protot files:
docgen:
@for f in `find . -type f -name '*.proto' -not -path './vendor/*' -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 \
--doc_out=docs/ $${f}/*.proto; \
done
# Regenerate proto files:
protoc:
@go mod tidy -v
@go mod vendor
# Install specific version for gogo-proto
@go list -f '{{.Path}}/...@{{.Version}}' -m github.com/gogo/protobuf | xargs go get -v
# Install specific version for protobuf lib
@go list -f '{{.Path}}/...@{{.Version}}' -m github.com/golang/protobuf | xargs go get -v
# Protoc generate
@for f in `find . -type f -name '*.proto' -not -path './vendor/*'`; do \
echo "${B}${G}⇒ Processing $$f ${R}"; \
protoc \
--proto_path=.:./vendor:/usr/local/include \
--gofast_out=plugins=grpc,paths=source_relative:. $$f; \
done