build: Add gosimple linter to goclean.sh
This commit is contained in:
parent
bca6409ade
commit
86346b5a95
7 changed files with 20 additions and 29 deletions
|
@ -1,11 +1,10 @@
|
||||||
language: go
|
language: go
|
||||||
go:
|
go:
|
||||||
- 1.6.3
|
- 1.6.x
|
||||||
- 1.7
|
- 1.7.x
|
||||||
sudo: false
|
sudo: false
|
||||||
install:
|
install:
|
||||||
- go get -d -t -v ./...
|
- go get -d -t -v ./...
|
||||||
- go get -v golang.org/x/tools/cmd/cover
|
|
||||||
- go get -v github.com/alecthomas/gometalinter
|
- go get -v github.com/alecthomas/gometalinter
|
||||||
- gometalinter --install
|
- gometalinter --install
|
||||||
script:
|
script:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2013, 2014 The btcsuite developers
|
// Copyright (c) 2013-2017 The btcsuite developers
|
||||||
// Use of this source code is governed by an ISC
|
// Use of this source code is governed by an ISC
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -12,14 +12,10 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/chaincfg"
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
"github.com/btcsuite/btcd/wire"
|
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/btcsuite/golangcrypto/ripemd160"
|
"github.com/btcsuite/golangcrypto/ripemd160"
|
||||||
)
|
)
|
||||||
|
|
||||||
// invalidNet is an invalid bitcoin network.
|
|
||||||
const invalidNet = wire.BitcoinNet(0xffffffff)
|
|
||||||
|
|
||||||
func TestAddresses(t *testing.T) {
|
func TestAddresses(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2013-2014 The btcsuite developers
|
// Copyright (c) 2013-2017 The btcsuite developers
|
||||||
// Use of this source code is governed by an ISC
|
// Use of this source code is governed by an ISC
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -24,10 +24,8 @@ func appDataDir(goos, appName string, roaming bool) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The caller really shouldn't prepend the appName with a period, but
|
// The caller really shouldn't prepend the appName with a period, but
|
||||||
// if they do, handle it gracefully by stripping it.
|
// if they do, handle it gracefully by trimming it.
|
||||||
if strings.HasPrefix(appName, ".") {
|
appName = strings.TrimPrefix(appName, ".")
|
||||||
appName = appName[1:]
|
|
||||||
}
|
|
||||||
appNameUpper := string(unicode.ToUpper(rune(appName[0]))) + appName[1:]
|
appNameUpper := string(unicode.ToUpper(rune(appName[0]))) + appName[1:]
|
||||||
appNameLower := string(unicode.ToLower(rune(appName[0]))) + appName[1:]
|
appNameLower := string(unicode.ToLower(rune(appName[0]))) + appName[1:]
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2013-2014 The btcsuite developers
|
// Copyright (c) 2013-2017 The btcsuite developers
|
||||||
// Use of this source code is governed by an ISC
|
// Use of this source code is governed by an ISC
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ func TestBase58(t *testing.T) {
|
||||||
t.Errorf("hex.DecodeString failed failed #%d: got: %s", x, test.in)
|
t.Errorf("hex.DecodeString failed failed #%d: got: %s", x, test.in)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if res := base58.Decode(test.out); bytes.Equal(res, b) != true {
|
if res := base58.Decode(test.out); !bytes.Equal(res, b) {
|
||||||
t.Errorf("Decode test #%d failed: got: %q want: %q",
|
t.Errorf("Decode test #%d failed: got: %q want: %q",
|
||||||
x, res, test.in)
|
x, res, test.in)
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2014-2016 The btcsuite developers
|
// Copyright (c) 2014-2017 The btcsuite developers
|
||||||
// Use of this source code is governed by an ISC
|
// Use of this source code is governed by an ISC
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -203,10 +203,8 @@ func (s MinNumberCoinSelector) CoinSelect(targetValue btcutil.Amount, coins []Co
|
||||||
sortedCoins := make([]Coin, 0, len(coins))
|
sortedCoins := make([]Coin, 0, len(coins))
|
||||||
sortedCoins = append(sortedCoins, coins...)
|
sortedCoins = append(sortedCoins, coins...)
|
||||||
sort.Sort(sort.Reverse(byAmount(sortedCoins)))
|
sort.Sort(sort.Reverse(byAmount(sortedCoins)))
|
||||||
return (&MinIndexCoinSelector{
|
|
||||||
MaxInputs: s.MaxInputs,
|
return MinIndexCoinSelector(s).CoinSelect(targetValue, sortedCoins)
|
||||||
MinChangeAmount: s.MinChangeAmount,
|
|
||||||
}).CoinSelect(targetValue, sortedCoins)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MaxValueAgeCoinSelector is a CoinSelector that attempts to construct
|
// MaxValueAgeCoinSelector is a CoinSelector that attempts to construct
|
||||||
|
@ -227,10 +225,8 @@ func (s MaxValueAgeCoinSelector) CoinSelect(targetValue btcutil.Amount, coins []
|
||||||
sortedCoins := make([]Coin, 0, len(coins))
|
sortedCoins := make([]Coin, 0, len(coins))
|
||||||
sortedCoins = append(sortedCoins, coins...)
|
sortedCoins = append(sortedCoins, coins...)
|
||||||
sort.Sort(sort.Reverse(byValueAge(sortedCoins)))
|
sort.Sort(sort.Reverse(byValueAge(sortedCoins)))
|
||||||
return (&MinIndexCoinSelector{
|
|
||||||
MaxInputs: s.MaxInputs,
|
return MinIndexCoinSelector(s).CoinSelect(targetValue, sortedCoins)
|
||||||
MinChangeAmount: s.MinChangeAmount,
|
|
||||||
}).CoinSelect(targetValue, sortedCoins)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MinPriorityCoinSelector is a CoinSelector that attempts to construct
|
// MinPriorityCoinSelector is a CoinSelector that attempts to construct
|
||||||
|
|
|
@ -4,9 +4,10 @@
|
||||||
# 2. goimports (https://github.com/bradfitz/goimports)
|
# 2. goimports (https://github.com/bradfitz/goimports)
|
||||||
# 3. golint (https://github.com/golang/lint)
|
# 3. golint (https://github.com/golang/lint)
|
||||||
# 4. go vet (http://golang.org/cmd/vet)
|
# 4. go vet (http://golang.org/cmd/vet)
|
||||||
# 5. unconvert (https://github.com/mdempsky/unconvert)
|
# 5. gosimple (https://github.com/dominikh/go-simple)
|
||||||
# 6. race detector (http://blog.golang.org/race-detector)
|
# 6. unconvert (https://github.com/mdempsky/unconvert)
|
||||||
# 7. test coverage (http://blog.golang.org/cover)
|
# 7. race detector (http://blog.golang.org/race-detector)
|
||||||
|
# 8. test coverage (http://blog.golang.org/cover)
|
||||||
#
|
#
|
||||||
# gometalint (github.com/alecthomas/gometalinter) is used to run each each
|
# gometalint (github.com/alecthomas/gometalinter) is used to run each each
|
||||||
# static checker.
|
# static checker.
|
||||||
|
@ -19,6 +20,7 @@ test -z "$(gometalinter --disable-all \
|
||||||
--enable=goimports \
|
--enable=goimports \
|
||||||
--enable=golint \
|
--enable=golint \
|
||||||
--enable=vet \
|
--enable=vet \
|
||||||
|
--enable=gosimple \
|
||||||
--enable=unconvert \
|
--enable=unconvert \
|
||||||
--deadline=120s ./... | grep -v 'ExampleNew' 2>&1 | tee /dev/stderr)"
|
--deadline=120s ./... | grep -v 'ExampleNew' 2>&1 | tee /dev/stderr)"
|
||||||
env GORACE="halt_on_error=1" go test -race ./...
|
env GORACE="halt_on_error=1" go test -race ./...
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2014 The btcsuite developers
|
// Copyright (c) 2014-2017 The btcsuite developers
|
||||||
// Use of this source code is governed by an ISC
|
// Use of this source code is governed by an ISC
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
@ -897,7 +897,7 @@ func TestZero(t *testing.T) {
|
||||||
// times.
|
// times.
|
||||||
testZeroed := func(i int, testName string, key *hdkeychain.ExtendedKey) bool {
|
testZeroed := func(i int, testName string, key *hdkeychain.ExtendedKey) bool {
|
||||||
// Zeroing a key should result in it no longer being private
|
// Zeroing a key should result in it no longer being private
|
||||||
if key.IsPrivate() != false {
|
if key.IsPrivate() {
|
||||||
t.Errorf("IsPrivate #%d (%s): mismatched key type -- "+
|
t.Errorf("IsPrivate #%d (%s): mismatched key type -- "+
|
||||||
"want private %v, got private %v", i, testName,
|
"want private %v, got private %v", i, testName,
|
||||||
false, key.IsPrivate())
|
false, key.IsPrivate())
|
||||||
|
|
Loading…
Reference in a new issue