...

Text file src/github.com/emicklei/proto/Makefile

Documentation: github.com/emicklei/proto

     1SHELL := /bin/bash -o pipefail
     2UNAME_OS := $(shell uname -s)
     3UNAME_ARCH := $(shell uname -m)
     4
     5TMP_BASE := .tmp
     6TMP := $(TMP_BASE)/$(UNAME_OS)/$(UNAME_ARCH)
     7TMP_BIN = $(TMP)/bin
     8
     9GOLINT_VERSION := 8f45f776aaf18cebc8d65861cc70c33c60471952
    10GOLINT := $(TMP_BIN)/golint
    11$(GOLINT):
    12	$(eval GOLINT_TMP := $(shell mktemp -d))
    13	@cd $(GOLINT_TMP); go get github.com/golang/lint/golint@$(GOLINT_VERSION)
    14	@rm -rf $(GOLINT_TMP)
    15
    16ERRCHECK_VERSION := v1.2.0
    17ERRCHECK := $(TMP_BIN)/errcheck
    18$(ERRCHECK):
    19	$(eval ERRCHECK_TMP := $(shell mktemp -d))
    20	@cd $(ERRCHECK_TMP); go get github.com/kisielk/errcheck@$(ERRCHECK_VERSION)
    21	@rm -rf $(ERRCHECK_TMP)
    22
    23STATICCHECK_VERSION := c2f93a96b099cbbec1de36336ab049ffa620e6d7
    24STATICCHECK := $(TMP_BIN)/staticcheck
    25$(STATICCHECK):
    26	$(eval STATICCHECK_TMP := $(shell mktemp -d))
    27	@cd $(STATICCHECK_TMP); go get honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK_VERSION)
    28	@rm -rf $(STATICCHECK_TMP)
    29
    30unexport GOPATH
    31export GO111MODULE := on
    32export GOBIN := $(abspath $(TMP_BIN))
    33export PATH := $(GOBIN):$(PATH)
    34
    35.DEFAULT_GOAL := all
    36
    37.PHONY: all
    38all: lint test
    39
    40.PHONY: install
    41install:
    42	go install ./...
    43
    44.PHONY: golint
    45golint: $(GOLINT)
    46	@# TODO: readd cmd/proto2gql when fixed
    47	@#for file in $(shell find . -name '*.go'); do
    48	for file in $(shell find . -name '*.go' | grep -v cmd/proto2gql); do \
    49		golint $${file}; \
    50		if [ -n "$$(golint $${file})" ]; then \
    51			exit 1; \
    52		fi; \
    53	done
    54
    55.PHONY: vet
    56vet:
    57	go vet ./...
    58
    59.PHONY: testdeps
    60errcheck: $(ERRCHECK)
    61	errcheck ./...
    62
    63.PHONY: staticcheck
    64staticcheck: $(STATICCHECK)
    65	staticcheck -checks "all -U1000" ./...
    66
    67.PHONY: lint
    68# TODO: readd errcheck when fixed
    69#lint: golint vet errcheck staticcheck
    70#lint: golint vet staticcheck
    71lint: golint vet
    72
    73.PHONY: test
    74test:
    75	go test -race -coverprofile=coverage.txt -covermode=atomic ./...
    76
    77.PHONY: clean
    78clean:
    79	go clean -i ./...
    80
    81.PHONY: integration
    82integration:
    83	PB=y go test -cover

View as plain text