github.com/weaveworks/common@v0.0.0-20230728070032-dd9e68f319d5/Makefile (about) 1 .PHONY: all test clean 2 .DEFAULT_GOAL := all 3 4 all: 5 6 GENERATED_PROTOS=server/fake_server.pb.go httpgrpc/httpgrpc.pb.go middleware/middleware_test/echo_server.pb.go 7 8 # All the boiler plate for building golang follows: 9 SUDO := $(shell docker info >/dev/null 2>&1 || echo "sudo -E") 10 RM := --rm 11 GO_FLAGS := -ldflags "-extldflags \"-static\" -linkmode=external -s -w" -tags netgo -i 12 13 # A 3-year-old image which is a reasonable match for the last time the files were generated. 14 PROTOC_IMAGE=namely/protoc:1.23_0 15 16 protos: 17 docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/weaveworks/common -w /go/src/github.com/weaveworks/common $(PROTOC_IMAGE) --proto_path=/go/src/github.com/weaveworks/common --go_out=plugins=grpc:/go/src/ server/fake_server.proto 18 docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/weaveworks/common -w /go/src/github.com/weaveworks/common $(PROTOC_IMAGE) --proto_path=/go/src/github.com/weaveworks/common --go_out=plugins=grpc:/go/src/ middleware/middleware_test/echo_server.proto 19 docker run $(RM) --user $(id -u):$(id -g) -v $(shell pwd):/go/src/github.com/weaveworks/common -w /go/src/github.com/weaveworks/common $(PROTOC_IMAGE) -I/go/src/github.com/weaveworks/common -I/go/src/github.com/weaveworks/common/vendor/github.com/gogo/protobuf/ --proto_path=/go/src/github.com/weaveworks/common --gogofast_out=plugins=grpc:/go/src/ httpgrpc/httpgrpc.proto 20 21 protos: $(GENERATED_PROTOS) 22 23 check-protos: protos 24 git diff --exit-code || (echo "Please rebuild protobuf code by running 'make protos'" && false) 25 26 lint: 27 golangci-lint run --new-from-rev d2f56921e6b0 28 29 test: 30 go test ./... 31 32 clean: 33 go clean ./...