Merge PR #2464: Lock binary dependencies to a specific commits / versions
This commit is contained in:
commit
7e9c39e915
|
@ -56,6 +56,7 @@ jobs:
|
||||||
name: Get metalinter
|
name: Get metalinter
|
||||||
command: |
|
command: |
|
||||||
export PATH="$GOBIN:$PATH"
|
export PATH="$GOBIN:$PATH"
|
||||||
|
make get_tools
|
||||||
make get_dev_tools
|
make get_dev_tools
|
||||||
- run:
|
- run:
|
||||||
name: Lint source
|
name: Lint source
|
||||||
|
|
29
Makefile
29
Makefile
|
@ -6,6 +6,10 @@ BUILD_FLAGS = -tags "${BUILD_TAGS}" -ldflags "-X github.com/cosmos/cosmos-sdk/ve
|
||||||
GCC := $(shell command -v gcc 2> /dev/null)
|
GCC := $(shell command -v gcc 2> /dev/null)
|
||||||
LEDGER_ENABLED ?= true
|
LEDGER_ENABLED ?= true
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
|
GOTOOLS = \
|
||||||
|
github.com/golang/dep/cmd/dep \
|
||||||
|
github.com/alecthomas/gometalinter \
|
||||||
|
github.com/rakyll/statik
|
||||||
all: get_tools get_vendor_deps install install_examples install_cosmos-sdk-cli test_lint test
|
all: get_tools get_vendor_deps install install_examples install_cosmos-sdk-cli test_lint test
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
|
@ -91,22 +95,27 @@ dist:
|
||||||
### Tools & dependencies
|
### Tools & dependencies
|
||||||
|
|
||||||
check_tools:
|
check_tools:
|
||||||
cd tools && $(MAKE) check_tools
|
@# https://stackoverflow.com/a/25668869
|
||||||
|
@echo "Found tools: $(foreach tool,$(notdir $(GOTOOLS)),\
|
||||||
check_dev_tools:
|
$(if $(shell which $(tool)),$(tool),$(error "No $(tool) in PATH")))"
|
||||||
cd tools && $(MAKE) check_dev_tools
|
|
||||||
|
|
||||||
update_tools:
|
update_tools:
|
||||||
cd tools && $(MAKE) update_tools
|
@echo "--> Updating tools to correct version"
|
||||||
|
./scripts/get_tools.sh
|
||||||
|
|
||||||
update_dev_tools:
|
update_dev_tools:
|
||||||
cd tools && $(MAKE) 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:
|
get_tools:
|
||||||
cd tools && $(MAKE) get_tools
|
@echo "--> Installing tools"
|
||||||
|
./scripts/get_tools.sh
|
||||||
|
|
||||||
get_dev_tools:
|
get_dev_tools:
|
||||||
cd tools && $(MAKE) get_dev_tools
|
@echo "--> Downloading linters (this may take awhile)"
|
||||||
|
$(GOPATH)/src/github.com/alecthomas/gometalinter/scripts/install.sh -b $(GOBIN)
|
||||||
|
go get github.com/tendermint/lint/golint
|
||||||
|
|
||||||
get_vendor_deps:
|
get_vendor_deps:
|
||||||
@echo "--> Generating vendor directory via dep ensure"
|
@echo "--> Generating vendor directory via dep ensure"
|
||||||
|
@ -181,8 +190,8 @@ test_cover:
|
||||||
@export VERSION=$(VERSION); bash tests/test_cover.sh
|
@export VERSION=$(VERSION); bash tests/test_cover.sh
|
||||||
|
|
||||||
test_lint:
|
test_lint:
|
||||||
gometalinter.v2 --config=tools/gometalinter.json ./...
|
gometalinter --config=tools/gometalinter.json ./...
|
||||||
!(gometalinter.v2 --exclude /usr/lib/go/src/ --exclude client/lcd/statik/statik.go --disable-all --enable='errcheck' --vendor ./... | grep -v "client/")
|
!(gometalinter --exclude /usr/lib/go/src/ --exclude client/lcd/statik/statik.go --exclude 'vendor/*' --disable-all --enable='errcheck' --vendor ./... | grep -v "client/")
|
||||||
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s
|
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s
|
||||||
dep status >> /dev/null
|
dep status >> /dev/null
|
||||||
!(grep -n branch Gopkg.toml)
|
!(grep -n branch Gopkg.toml)
|
||||||
|
|
|
@ -170,6 +170,7 @@ IMPROVEMENTS
|
||||||
calls which includes dynamic consumption of value length.
|
calls which includes dynamic consumption of value length.
|
||||||
* [types/decimal] \#2378 - Added truncate functionality to decimal
|
* [types/decimal] \#2378 - Added truncate functionality to decimal
|
||||||
* [client] [\#1184](https://github.com/cosmos/cosmos-sdk/issues/1184) Remove unused `client/tx/sign.go`.
|
* [client] [\#1184](https://github.com/cosmos/cosmos-sdk/issues/1184) Remove unused `client/tx/sign.go`.
|
||||||
|
* [tools] \#2464 Lock binary dependencies to a specific version
|
||||||
|
|
||||||
* Tendermint
|
* Tendermint
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ func generateSelfSignedCert(host string) (certBytes []byte, priv *ecdsa.PrivateK
|
||||||
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
|
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
|
||||||
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
|
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
|
||||||
BasicConstraintsValid: true,
|
BasicConstraintsValid: true,
|
||||||
IsCA: true,
|
IsCA: true,
|
||||||
}
|
}
|
||||||
hosts := strings.Split(host, ",")
|
hosts := strings.Split(host, ",")
|
||||||
for _, h := range hosts {
|
for _, h := range hosts {
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# This file downloads all of the binary dependencies we have, and checks out a
|
||||||
|
# specific git hash.
|
||||||
|
#
|
||||||
|
# repos it installs:
|
||||||
|
# github.com/golang/dep/cmd/dep
|
||||||
|
# gopkg.in/alecthomas/gometalinter.v2
|
||||||
|
# github.com/rakyll/statiik
|
||||||
|
|
||||||
|
## check if GOPATH is set
|
||||||
|
if [ -z ${GOPATH+x} ]; then
|
||||||
|
echo "please set GOPATH (https://github.com/golang/go/wiki/SettingGOPATH)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "$GOPATH/src/github.com"
|
||||||
|
cd "$GOPATH/src/github.com" || exit 1
|
||||||
|
|
||||||
|
installFromGithub() {
|
||||||
|
repo=$1
|
||||||
|
commit=$2
|
||||||
|
# optional
|
||||||
|
subdir=$3
|
||||||
|
echo "--> Installing $repo ($commit)..."
|
||||||
|
if [ ! -d "$repo" ]; then
|
||||||
|
mkdir -p "$repo"
|
||||||
|
git clone "https://github.com/$repo.git" "$repo"
|
||||||
|
fi
|
||||||
|
if [ ! -z ${subdir+x} ] && [ ! -d "$repo/$subdir" ]; then
|
||||||
|
echo "ERROR: no such directory $repo/$subdir"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
pushd "$repo" && \
|
||||||
|
git fetch origin && \
|
||||||
|
git checkout -q "$commit" && \
|
||||||
|
if [ ! -z ${subdir+x} ]; then cd "$subdir" || exit 1; fi && \
|
||||||
|
go install && \
|
||||||
|
if [ ! -z ${subdir+x} ]; then cd - || exit 1; fi && \
|
||||||
|
popd || exit 1
|
||||||
|
echo "--> Done"
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
installFromGithub golang/dep 22125cfaa6ddc71e145b1535d4b7ee9744fefff2 cmd/dep
|
||||||
|
## gometalinter v2.0.11
|
||||||
|
installFromGithub alecthomas/gometalinter 17a7ffa42374937bfecabfb8d2efbd4db0c26741
|
||||||
|
installFromGithub rakyll/statik v0.1.5
|
170
tools/Makefile
170
tools/Makefile
|
@ -1,170 +0,0 @@
|
||||||
all: get_tools
|
|
||||||
|
|
||||||
|
|
||||||
########################################
|
|
||||||
### DEP
|
|
||||||
|
|
||||||
DEP = github.com/golang/dep/cmd/dep
|
|
||||||
GOLINT = github.com/tendermint/lint/golint
|
|
||||||
GOMETALINTER = gopkg.in/alecthomas/gometalinter.v2
|
|
||||||
UNCONVERT = github.com/mdempsky/unconvert
|
|
||||||
INEFFASSIGN = github.com/gordonklaus/ineffassign
|
|
||||||
MISSPELL = github.com/client9/misspell/cmd/misspell
|
|
||||||
ERRCHECK = github.com/kisielk/errcheck
|
|
||||||
UNPARAM = mvdan.cc/unparam
|
|
||||||
STATIK = github.com/rakyll/statik
|
|
||||||
|
|
||||||
DEP_CHECK := $(shell command -v dep 2> /dev/null)
|
|
||||||
GOLINT_CHECK := $(shell command -v golint 2> /dev/null)
|
|
||||||
GOMETALINTER_CHECK := $(shell command -v gometalinter.v2 2> /dev/null)
|
|
||||||
UNCONVERT_CHECK := $(shell command -v unconvert 2> /dev/null)
|
|
||||||
INEFFASSIGN_CHECK := $(shell command -v ineffassign 2> /dev/null)
|
|
||||||
MISSPELL_CHECK := $(shell command -v misspell 2> /dev/null)
|
|
||||||
ERRCHECK_CHECK := $(shell command -v errcheck 2> /dev/null)
|
|
||||||
UNPARAM_CHECK := $(shell command -v unparam 2> /dev/null)
|
|
||||||
STATIK_CHECK := $(shell command -v statik 2> /dev/null)
|
|
||||||
|
|
||||||
check_tools:
|
|
||||||
ifndef DEP_CHECK
|
|
||||||
@echo "No dep in path. Install with 'make get_tools'."
|
|
||||||
else
|
|
||||||
@echo "Found dep in path."
|
|
||||||
endif
|
|
||||||
|
|
||||||
check_dev_tools:
|
|
||||||
$(MAKE) check_tools
|
|
||||||
ifndef GOLINT_CHECK
|
|
||||||
@echo "No golint in path. Install with 'make get_tools'."
|
|
||||||
else
|
|
||||||
@echo "Found golint in path."
|
|
||||||
endif
|
|
||||||
ifndef GOMETALINTER_CHECK
|
|
||||||
@echo "No gometalinter in path. Install with 'make get_tools'."
|
|
||||||
else
|
|
||||||
@echo "Found gometalinter in path."
|
|
||||||
endif
|
|
||||||
ifndef UNCONVERT_CHECK
|
|
||||||
@echo "No unconvert in path. Install with 'make get_tools'."
|
|
||||||
else
|
|
||||||
@echo "Found unconvert in path."
|
|
||||||
endif
|
|
||||||
ifndef INEFFASSIGN_CHECK
|
|
||||||
@echo "No ineffassign in path. Install with 'make get_tools'."
|
|
||||||
else
|
|
||||||
@echo "Found ineffassign in path."
|
|
||||||
endif
|
|
||||||
ifndef MISSPELL_CHECK
|
|
||||||
@echo "No misspell in path. Install with 'make get_tools'."
|
|
||||||
else
|
|
||||||
@echo "Found misspell in path."
|
|
||||||
endif
|
|
||||||
ifndef ERRCHECK_CHECK
|
|
||||||
@echo "No errcheck in path. Install with 'make get_tools'."
|
|
||||||
else
|
|
||||||
@echo "Found errcheck in path."
|
|
||||||
endif
|
|
||||||
ifndef UNPARAM_CHECK
|
|
||||||
@echo "No unparam in path. Install with 'make get_tools'."
|
|
||||||
else
|
|
||||||
@echo "Found unparam in path."
|
|
||||||
endif
|
|
||||||
ifndef STATIK_CHECK
|
|
||||||
@echo "No statik in path. Install with 'make get_tools'."
|
|
||||||
else
|
|
||||||
@echo "Found statik in path."
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
get_tools:
|
|
||||||
ifdef DEP_CHECK
|
|
||||||
@echo "Dep is already installed. Run 'make update_tools' to update."
|
|
||||||
else
|
|
||||||
@echo "Installing dep"
|
|
||||||
go get -v $(DEP)
|
|
||||||
endif
|
|
||||||
ifdef STATIK_CHECK
|
|
||||||
@echo "Statik is already installed. Run 'make update_tools' to update."
|
|
||||||
else
|
|
||||||
@echo "Installing statik"
|
|
||||||
go version
|
|
||||||
go get -v $(STATIK)
|
|
||||||
endif
|
|
||||||
|
|
||||||
get_dev_tools:
|
|
||||||
$(MAKE) get_tools
|
|
||||||
ifdef GOLINT_CHECK
|
|
||||||
@echo "Golint is already installed. Run 'make update_tools' to update."
|
|
||||||
else
|
|
||||||
@echo "Installing golint"
|
|
||||||
go get -v $(GOLINT)
|
|
||||||
endif
|
|
||||||
ifdef GOMETALINTER_CHECK
|
|
||||||
@echo "Gometalinter.v2 is already installed. Run 'make update_tools' to update."
|
|
||||||
else
|
|
||||||
@echo "Installing gometalinter.v2"
|
|
||||||
go get -v $(GOMETALINTER)
|
|
||||||
endif
|
|
||||||
ifdef UNCONVERT_CHECK
|
|
||||||
@echo "Unconvert is already installed. Run 'make update_tools' to update."
|
|
||||||
else
|
|
||||||
@echo "Installing unconvert"
|
|
||||||
go get -v $(UNCONVERT)
|
|
||||||
endif
|
|
||||||
ifdef INEFFASSIGN_CHECK
|
|
||||||
@echo "Ineffassign is already installed. Run 'make update_tools' to update."
|
|
||||||
else
|
|
||||||
@echo "Installing ineffassign"
|
|
||||||
go get -v $(INEFFASSIGN)
|
|
||||||
endif
|
|
||||||
ifdef MISSPELL_CHECK
|
|
||||||
@echo "misspell is already installed. Run 'make update_tools' to update."
|
|
||||||
else
|
|
||||||
@echo "Installing misspell"
|
|
||||||
go get -v $(MISSPELL)
|
|
||||||
endif
|
|
||||||
ifdef ERRCHECK_CHECK
|
|
||||||
@echo "errcheck is already installed. Run 'make update_tools' to update."
|
|
||||||
else
|
|
||||||
@echo "Installing errcheck"
|
|
||||||
go get -v $(ERRCHECK)
|
|
||||||
endif
|
|
||||||
ifdef UNPARAM_CHECK
|
|
||||||
@echo "unparam is already installed. Run 'make update_tools' to update."
|
|
||||||
else
|
|
||||||
@echo "Installing unparam"
|
|
||||||
go get -v $(UNPARAM)
|
|
||||||
endif
|
|
||||||
ifdef STATIK_CHECK
|
|
||||||
@echo "statik is already installed. Run 'make update_tools' to update."
|
|
||||||
else
|
|
||||||
@echo "Installing statik"
|
|
||||||
go get -v $(STATIK)
|
|
||||||
endif
|
|
||||||
|
|
||||||
update_tools:
|
|
||||||
@echo "Updating dep"
|
|
||||||
go get -u -v $(DEP)
|
|
||||||
|
|
||||||
update_dev_tools:
|
|
||||||
$(MAKE) update_tools
|
|
||||||
@echo "Updating tendermint/golint"
|
|
||||||
go get -u -v $(GOLINT)
|
|
||||||
@echo "Updating gometalinter.v2"
|
|
||||||
go get -u -v $(GOMETALINTER)
|
|
||||||
@echo "Updating unconvert"
|
|
||||||
go get -u -v $(UNCONVERT)
|
|
||||||
@echo "Updating ineffassign"
|
|
||||||
go get -u -v $(INEFFASSIGN)
|
|
||||||
@echo "Updating misspell"
|
|
||||||
go get -u -v $(MISSPELL)
|
|
||||||
@echo "Updating errcheck"
|
|
||||||
go get -u -v $(ERRCHECK)
|
|
||||||
@echo "Updating unparam"
|
|
||||||
go get -u -v $(UNPARAM)
|
|
||||||
@echo "Updating statik"
|
|
||||||
go get -u -v $(STATIK)
|
|
||||||
|
|
||||||
# To avoid unintended conflicts with file names, always add to .PHONY
|
|
||||||
# unless there is a reason not to.
|
|
||||||
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
|
|
||||||
.PHONY: check_tools get_tools update_tools check_dev_tools get_dev_tools update_dev_tools
|
|
|
@ -6,5 +6,5 @@
|
||||||
"Deadline": "500s",
|
"Deadline": "500s",
|
||||||
"Vendor": true,
|
"Vendor": true,
|
||||||
"Cyclo": 11,
|
"Cyclo": 11,
|
||||||
"Exclude": ["/usr/lib/go/src/", "client/lcd/statik/statik.go"]
|
"Exclude": ["/usr/lib/go/src/", "client/lcd/statik/statik.go", "vendor/*"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,9 @@ func NewValidatorDistInfo(operatorAddr sdk.ValAddress, currentHeight int64) Vali
|
||||||
return ValidatorDistInfo{
|
return ValidatorDistInfo{
|
||||||
OperatorAddr: operatorAddr,
|
OperatorAddr: operatorAddr,
|
||||||
FeePoolWithdrawalHeight: currentHeight,
|
FeePoolWithdrawalHeight: currentHeight,
|
||||||
Pool: DecCoins{},
|
Pool: DecCoins{},
|
||||||
PoolCommission: DecCoins{},
|
PoolCommission: DecCoins{},
|
||||||
DelAccum: NewTotalAccum(currentHeight),
|
DelAccum: NewTotalAccum(currentHeight),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue