From f8379818c0c3a86218c7ff54222b54405a0d4682 Mon Sep 17 00:00:00 2001 From: Greg Szabo Date: Thu, 22 Nov 2018 13:09:45 -0500 Subject: [PATCH 1/3] Added goimports tool to get_tools. Get_tools now only builds new versions if binaries are missing. --- Makefile | 12 ++++-------- PENDING.md | 1 + scripts/Makefile | 13 ++++++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 35e5b50eff1f..c8f579f8dae8 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,9 @@ GOTOOLS = \ GOBIN ?= $(GOPATH)/bin all: get_tools get_vendor_deps install install_examples install_cosmos-sdk-cli test_lint test +# The below include contains the get_tools target. +include scripts/Makefile + ######################################## ### CI @@ -107,20 +110,13 @@ check_tools: update_tools: @echo "--> Updating tools to correct version" - $(MAKE) -C scripts get_tools + $(MAKE) --always-make get_tools update_dev_tools: @echo "--> Downloading linters (this may take awhile)" $(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN) go get -u github.com/tendermint/lint/golint -get_tools: $(GOBIN)/dep $(GOBIN)/gometalinter $(GOBIN)/statik - @echo "--> Installing tools" - $(MAKE) -C scripts get_tools - -$(GOBIN)/%: - $(MAKE) -C scripts $(subst $(GOBIN)/,,$(@)) - get_dev_tools: get_tools @echo "--> Downloading linters (this may take awhile)" $(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN) diff --git a/PENDING.md b/PENDING.md index 47c6ab60e5ff..b9b98ce0fbd8 100644 --- a/PENDING.md +++ b/PENDING.md @@ -60,6 +60,7 @@ IMPROVEMENTS - #2772 Update BaseApp to not persist state when the ante handler fails on DeliverTx. - #2773 Require moniker to be provided on `gaiad init`. - #2672 [Makefile] Updated for better Windows compatibility and ledger support logic, get_tools was rewritten as a cross-compatible Makefile. + - #2766 [Makefile] Added goimports tool to get_tools. Get_tools now only builds new versions if binaries are missing. - [#110](https://github.com/tendermint/devops/issues/110) Updated CircleCI job to trigger website build when cosmos docs are updated. * SDK diff --git a/scripts/Makefile b/scripts/Makefile index 9abc497e45d4..07d37e538d2d 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -37,18 +37,21 @@ go_install = $(call go_get,$(1),$(2),$(3)) && cd $(GITHUBDIR)$(FS)$(1)$(FS)$(2) # get_tools ### all: get_tools -get_tools: dep gometalinter statik +get_tools: $(GOPATH)/bin/dep $(GOPATH)/bin/gometalinter $(GOPATH)/bin/statik $(GOPATH)/bin/goimports -dep: +$(GOPATH)/bin/dep: $(call go_get,golang,dep,22125cfaa6ddc71e145b1535d4b7ee9744fefff2) cd $(GITHUBDIR)$(FS)golang$(FS)dep$(FS)cmd$(FS)dep && $(GO) install #v2.0.11 -gometalinter: +$(GOPATH)/bin/gometalinter: $(call go_install,alecthomas,gometalinter,17a7ffa42374937bfecabfb8d2efbd4db0c26741) -statik: +$(GOPATH)/bin/statik: $(call go_install,rakyll,statik,v0.1.5) -.PHONY: all get_tools dep gometalinter statik +$(GOPATH)/bin/goimports: + go install golang.org/x/tools/cmd/goimports + +.PHONY: all get_tools From fe8e1b268574820b2299b69cea8501a95def4fcb Mon Sep 17 00:00:00 2001 From: Greg Szabo Date: Thu, 22 Nov 2018 13:18:16 -0500 Subject: [PATCH 2/3] Added the goimports format command from yutianwu's PR --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index c8f579f8dae8..f4475d1d9ef1 100644 --- a/Makefile +++ b/Makefile @@ -208,6 +208,7 @@ test_lint: format: find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofmt -w -s find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/cosmos/cosmos-sdk benchmark: @go test -bench=. $(PACKAGES_NOSIMULATION) From 602e4574a0c402e72058c1fdfd103035968bd7ac Mon Sep 17 00:00:00 2001 From: Greg Szabo Date: Thu, 22 Nov 2018 13:29:12 -0500 Subject: [PATCH 3/3] goimports install typo fix --- scripts/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile b/scripts/Makefile index 07d37e538d2d..90cb84231106 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -51,7 +51,7 @@ $(GOPATH)/bin/statik: $(call go_install,rakyll,statik,v0.1.5) $(GOPATH)/bin/goimports: - go install golang.org/x/tools/cmd/goimports + go get golang.org/x/tools/cmd/goimports .PHONY: all get_tools