Added goimports tool to get_tools. Fixed get_tools build. (#2889)

* Added goimports tool to get_tools. Get_tools now only builds new versions if binaries are missing.
* Added the goimports format command from yutianwu's PR
* goimports install typo fix
This commit is contained in:
Greg Szabo 2018-11-26 14:20:43 -05:00 committed by Jack Zampolin
parent 469b8eff6b
commit 2e0dfc31af
3 changed files with 14 additions and 13 deletions

View File

@ -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)
@ -216,6 +212,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)

View File

@ -65,6 +65,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

View File

@ -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 get golang.org/x/tools/cmd/goimports
.PHONY: all get_tools