Skip to content

Commit

Permalink
Added goimports tool to get_tools. Fixed get_tools build. (#2889)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
greg-szabo authored and jackzampolin committed Nov 26, 2018
1 parent 469b8ef commit 2e0dfc3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
13 changes: 5 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 2e0dfc3

Please sign in to comment.