github.com/newrelic/newrelic-client-go@v1.1.0/build/tools.mk (about) 1 # 2 # Makefile fragment for installing tools 3 # 4 5 GO ?= go 6 GOFMT ?= gofmt 7 GO_MOD_OUTDATED ?= go-mod-outdated 8 BUILD_DIR ?= ./bin/ 9 10 # Go file to track tool deps with go modules 11 TOOL_DIR ?= tools 12 TOOL_CONFIG ?= $(TOOL_DIR)/tools.go 13 14 GOTOOLS ?= $(shell cd $(TOOL_DIR) && go list -f '{{ .Imports }}' -tags tools |tr -d '[]') 15 16 tools: check-version 17 @echo "=== $(PROJECT_NAME) === [ tools ]: Installing tools required by the project..." 18 @cd $(TOOL_DIR) && $(GO) mod download 19 @cd $(TOOL_DIR) && $(GO) install $(GOTOOLS) 20 @cd $(TOOL_DIR) && $(GO) mod tidy 21 22 tools-outdated: check-version 23 @echo "=== $(PROJECT_NAME) === [ tools-outdated ]: Finding outdated tool deps with $(GO_MOD_OUTDATED)..." 24 @cd $(TOOL_DIR) && $(GO) list -u -m -json all | $(GO_MOD_OUTDATED) -direct -update 25 26 tools-update: check-version 27 @echo "=== $(PROJECT_NAME) === [ tools-update ]: Updating tools required by the project..." 28 @cd $(TOOL_DIR) && for x in $(GOTOOLS); do \ 29 $(GO) get -u $$x; \ 30 done 31 @cd $(TOOL_DIR) && $(GO) mod tidy 32 33 .PHONY: tools tools-update tools-outdated