-
Notifications
You must be signed in to change notification settings - Fork 70
/
gotools.mk
29 lines (23 loc) · 889 Bytes
/
gotools.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Copyright IBM Corp All Rights Reserved.
# Copyright London Stock Exchange Group All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
GOTOOLS = goimports golint staticcheck
BUILD_DIR ?= build
GOTOOLS_BINDIR ?= $(shell go env GOBIN)
# go tool->path mapping
go.fqp.goimports := golang.org/x/tools/cmd/goimports
go.fqp.golint := golang.org/x/lint/golint
go.fqp.staticcheck := honnef.co/go/tools/cmd/staticcheck
.PHONY: gotools-install
gotools-install: $(patsubst %,$(GOTOOLS_BINDIR)/%, $(GOTOOLS))
.PHONY: gotools-clean
gotools-clean:
# Default rule for gotools uses the name->path map for a generic 'go get' style build
gotool.%:
$(eval TOOL = ${subst gotool.,,${@}})
@echo "Building ${go.fqp.${TOOL}} -> $(TOOL)"
go install ${go.fqp.${TOOL}}@latest
$(GOTOOLS_BINDIR)/%:
$(eval TOOL = ${subst $(GOTOOLS_BINDIR)/,,${@}})
@$(MAKE) -f gotools.mk gotool.$(TOOL)