From 8be708fe5b2c063e3f6d4e610f1d61802525e00f Mon Sep 17 00:00:00 2001 From: Petabyte Storage Date: Mon, 11 Dec 2017 20:48:15 -0800 Subject: [PATCH 1/5] fix spelling and makefile gometalinter.v2 --- Makefile | 9 ++++++--- cmd/tendermint/commands/probe_upnp.go | 2 +- p2p/connection.go | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 36ba6097b..0f3ce07c4 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,9 @@ all: get_vendor_deps install test install: go install $(BUILD_FLAGS) ./cmd/tendermint +install_metalinter_v2: + which gometalinter.v2 || make tools + build: go build $(BUILD_FLAGS) -o build/tendermint ./cmd/tendermint/ @@ -74,10 +77,10 @@ tools: ### Formatting, linting, and vetting -metalinter: +metalinter: install_metalinter_v2 $(GOPATH)/bin/gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./... -metalinter_test: +metalinter_test: install_metalinter_v2 $(GOPATH)/bin/gometalinter.v2 --vendor --deadline=600s --disable-all \ --enable=deadcode \ --enable=gosimple \ @@ -106,4 +109,4 @@ metalinter_test: #--enable=vet \ #--enable=vetshadow \ -.PHONY: install build build_race dist test test_race test_integrations test100 draw_deps get_vendor_deps update_vendor_deps update_tools tools test_release +.PHONY: install install_metalinter_v2 build build_race dist test test_race test_integrations test100 draw_deps get_vendor_deps update_vendor_deps update_tools tools test_release diff --git a/cmd/tendermint/commands/probe_upnp.go b/cmd/tendermint/commands/probe_upnp.go index 643b7713f..a37bc3602 100644 --- a/cmd/tendermint/commands/probe_upnp.go +++ b/cmd/tendermint/commands/probe_upnp.go @@ -19,7 +19,7 @@ var ProbeUpnpCmd = &cobra.Command{ func probeUpnp(cmd *cobra.Command, args []string) error { capabilities, err := upnp.Probe(logger) if err != nil { - fmt.Println("Probe failed: %v", err) + fmt.Println("Probe failed: ", err) } else { fmt.Println("Probe success!") jsonBytes, err := json.Marshal(capabilities) diff --git a/p2p/connection.go b/p2p/connection.go index b01674033..51f6dd3bb 100644 --- a/p2p/connection.go +++ b/p2p/connection.go @@ -22,7 +22,7 @@ const ( numBatchMsgPackets = 10 minReadBufferSize = 1024 minWriteBufferSize = 65536 - updateState = 2 * time.Second + updateStats = 2 * time.Second pingTimeout = 40 * time.Second // some of these defaults are written in the user config @@ -169,7 +169,7 @@ func (c *MConnection) OnStart() error { c.quit = make(chan struct{}) c.flushTimer = cmn.NewThrottleTimer("flush", c.config.flushThrottle) c.pingTimer = cmn.NewRepeatTimer("ping", pingTimeout) - c.chStatsTimer = cmn.NewRepeatTimer("chStats", updateState) + c.chStatsTimer = cmn.NewRepeatTimer("chStats", updateStats) go c.sendRoutine() go c.recvRoutine() return nil From 10265d86672c2dace82a88b8c20b59d18bfca1ef Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Mon, 11 Dec 2017 23:02:42 -0600 Subject: [PATCH 2/5] add tools to make all because it's required for test target --- Makefile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 0f3ce07c4..269372838 100644 --- a/Makefile +++ b/Makefile @@ -9,14 +9,11 @@ TMHOME = $${TMHOME:-$$HOME/.tendermint} BUILD_FLAGS = -ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short HEAD`" -all: get_vendor_deps install test +all: tools get_vendor_deps install test install: go install $(BUILD_FLAGS) ./cmd/tendermint -install_metalinter_v2: - which gometalinter.v2 || make tools - build: go build $(BUILD_FLAGS) -o build/tendermint ./cmd/tendermint/ @@ -77,10 +74,10 @@ tools: ### Formatting, linting, and vetting -metalinter: install_metalinter_v2 +metalinter: $(GOPATH)/bin/gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./... -metalinter_test: install_metalinter_v2 +metalinter_test: $(GOPATH)/bin/gometalinter.v2 --vendor --deadline=600s --disable-all \ --enable=deadcode \ --enable=gosimple \ @@ -109,4 +106,4 @@ metalinter_test: install_metalinter_v2 #--enable=vet \ #--enable=vetshadow \ -.PHONY: install install_metalinter_v2 build build_race dist test test_race test_integrations test100 draw_deps get_vendor_deps update_vendor_deps update_tools tools test_release +.PHONY: install build build_race dist test test_race test_integrations test100 draw_deps get_vendor_deps update_vendor_deps update_tools tools test_release From a6644f747752d9022529664d87452f57be25fdeb Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Mon, 11 Dec 2017 23:05:22 -0600 Subject: [PATCH 3/5] remove gopath prefixes it's safe because I added GOPATH to PATH earlier today --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 269372838..bb817f0d5 100644 --- a/Makefile +++ b/Makefile @@ -58,10 +58,10 @@ get_vendor_deps: @hash glide 2>/dev/null || go get github.com/Masterminds/glide @rm -rf vendor/ @echo "--> Running glide install" - @$(GOPATH)/bin/glide install + @glide install update_vendor_deps: - @$(GOPATH)/bin/glide update + @glide update update_tools: @echo "--> Updating tools" @@ -70,15 +70,15 @@ update_tools: tools: @echo "--> Installing tools" @go get $(GOTOOLS) - $(GOPATH)/bin/gometalinter.v2 --install + @gometalinter.v2 --install ### Formatting, linting, and vetting metalinter: - $(GOPATH)/bin/gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./... + gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./... metalinter_test: - $(GOPATH)/bin/gometalinter.v2 --vendor --deadline=600s --disable-all \ + gometalinter.v2 --vendor --deadline=600s --disable-all \ --enable=deadcode \ --enable=gosimple \ --enable=misspell \ From 49e5510953c4769c3253220ea2eea7b9b8b5c852 Mon Sep 17 00:00:00 2001 From: Petabyte Storage Date: Mon, 11 Dec 2017 21:44:53 -0800 Subject: [PATCH 4/5] remove tools from all --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bb817f0d5..706145dca 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ TMHOME = $${TMHOME:-$$HOME/.tendermint} BUILD_FLAGS = -ldflags "-X github.com/tendermint/tendermint/version.GitCommit=`git rev-parse --short HEAD`" -all: tools get_vendor_deps install test +all: get_vendor_deps install test install: go install $(BUILD_FLAGS) ./cmd/tendermint From ae632654d2ef999c015f4bffe3510cc2a41eb58a Mon Sep 17 00:00:00 2001 From: Petabyte Storage Date: Mon, 11 Dec 2017 22:58:20 -0800 Subject: [PATCH 5/5] add tools check with short circuit --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 706145dca..57cb844ab 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,7 @@ get_vendor_deps: @rm -rf vendor/ @echo "--> Running glide install" @glide install + @make check_tools update_vendor_deps: @glide update @@ -67,6 +68,9 @@ update_tools: @echo "--> Updating tools" @go get -u $(GOTOOLS) +check_tools: + which gox || make tools + tools: @echo "--> Installing tools" @go get $(GOTOOLS) @@ -106,4 +110,4 @@ metalinter_test: #--enable=vet \ #--enable=vetshadow \ -.PHONY: install build build_race dist test test_race test_integrations test100 draw_deps get_vendor_deps update_vendor_deps update_tools tools test_release +.PHONY: install build build_race check_tools dist test test_race test_integrations test100 draw_deps get_vendor_deps update_vendor_deps update_tools tools test_release