github.com/w3security/vervet/v5@v5.3.1-0.20230618081846-5bd9b5d799dc/Makefile (about) 1 GO_BIN=$(shell pwd)/.bin/go 2 3 SHELL:=env PATH=$(GO_BIN):$(PATH) $(SHELL) 4 5 GOCI_LINT_V?=v1.51.0 6 7 .PHONY: all 8 all: lint test build 9 10 .PHONY: build 11 build: 12 go build -a -o vervet ./cmd/vervet 13 14 # Run go mod tidy yourself 15 16 #---------------------------------------------------------------------------------- 17 # Check for updates to packages in remote OSS repositories and update go.mod AND 18 # go.sum to match changes. Then download the all the dependencies 19 # This catches when your app has colliding versions of packages during updates 20 #---------------------------------------------------------------------------------- 21 .PHONY: update-deps 22 update-deps: 23 go get -d -u ./... 24 25 # go mod download yourself if you don't need to update 26 27 .PHONY: lint 28 lint: 29 golangci-lint run -v ./... 30 (cd versionware/example; golangci-lint run -v ./...) 31 32 .PHONY: lint-docker 33 lint-docker: 34 docker run --rm -v $(shell pwd):/vervet -w /vervet golangci/golangci-lint:${GOCI_LINT_V} golangci-lint run -v ./... 35 36 #---------------------------------------------------------------------------------- 37 # Ignores the test cache and forces a full test suite execution 38 #---------------------------------------------------------------------------------- 39 .PHONY: test 40 test: 41 go test ./... -count=1 42 (cd versionware/example; go generate . && go test ./... -count=1) 43 44 .PHONY: test-coverage 45 test-coverage: 46 go test ./... -count=1 -coverprofile=covfile 47 go tool cover -html=covfile 48 rm -f covfile 49 50 .PHONY: clean 51 clean: 52 $(RM) vervet 53 54 .PHONY: install-tools 55 install-tools: 56 ifndef CI 57 mkdir -p ${GO_BIN} 58 curl -sSfL 'https://raw.githubusercontent.com/golangci/golangci-lint/${GOCI_LINT_V}/install.sh' | sh -s -- -b ${GO_BIN} ${GOCI_LINT_V} 59 endif 60 61 .PHONY: format 62 format: ## Format source code with gofmt and golangci-lint 63 gofmt -s -w . 64 golangci-lint run --fix -v ./... 65 66 .PHONY: tidy 67 tidy: 68 go mod tidy -v