build: clean linter warnings
This commit is contained in:
parent
bc8d63bf15
commit
f7399e6157
12 changed files with 21 additions and 27 deletions
|
@ -63,7 +63,7 @@ func TestCalcWork(t *testing.T) {
|
|||
}
|
||||
|
||||
for x, test := range tests {
|
||||
bits := uint32(test.in)
|
||||
bits := test.in
|
||||
|
||||
r := CalcWork(bits)
|
||||
if r.Int64() != test.out {
|
||||
|
|
|
@ -68,7 +68,7 @@ func (b *addrIndexBucket) printLevels(addrKey [addrKeySize]byte) string {
|
|||
if !bytes.Equal(k[:levelOffset], addrKey[:]) {
|
||||
continue
|
||||
}
|
||||
level := uint8(k[levelOffset])
|
||||
level := k[levelOffset]
|
||||
if level > highestLevel {
|
||||
highestLevel = level
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ func (b *addrIndexBucket) sanityCheck(addrKey [addrKeySize]byte, expectedTotal i
|
|||
if !bytes.Equal(k[:levelOffset], addrKey[:]) {
|
||||
continue
|
||||
}
|
||||
level := uint8(k[levelOffset])
|
||||
level := k[levelOffset]
|
||||
if level > highestLevel {
|
||||
highestLevel = level
|
||||
}
|
||||
|
|
|
@ -232,11 +232,11 @@ func TestPubKeys(t *testing.T) {
|
|||
var pkStr []byte
|
||||
switch test.format {
|
||||
case pubkeyUncompressed:
|
||||
pkStr = (*PublicKey)(pk).SerializeUncompressed()
|
||||
pkStr = pk.SerializeUncompressed()
|
||||
case pubkeyCompressed:
|
||||
pkStr = (*PublicKey)(pk).SerializeCompressed()
|
||||
pkStr = pk.SerializeCompressed()
|
||||
case pubkeyHybrid:
|
||||
pkStr = (*PublicKey)(pk).SerializeHybrid()
|
||||
pkStr = pk.SerializeHybrid()
|
||||
}
|
||||
if !bytes.Equal(test.key, pkStr) {
|
||||
t.Errorf("%s pubkey: serialized keys do not match.",
|
||||
|
|
|
@ -464,8 +464,7 @@ func TestSignatureSerialize(t *testing.T) {
|
|||
|
||||
func testSignCompact(t *testing.T, tag string, curve *KoblitzCurve,
|
||||
data []byte, isCompressed bool) {
|
||||
tmp, _ := NewPrivateKey(curve)
|
||||
priv := (*PrivateKey)(tmp)
|
||||
priv, _ := NewPrivateKey(curve)
|
||||
|
||||
hashed := []byte("testing")
|
||||
sig, err := SignCompact(curve, priv, hashed, isCompressed)
|
||||
|
|
|
@ -287,6 +287,6 @@ func RegisteredCmdMethods() []string {
|
|||
methods = append(methods, k)
|
||||
}
|
||||
|
||||
sort.Sort(sort.StringSlice(methods))
|
||||
sort.Strings(methods)
|
||||
return methods
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@ func TestRegisteredCmdMethods(t *testing.T) {
|
|||
// Ensure the returned methods are sorted.
|
||||
sortedMethods := make([]string, len(methods))
|
||||
copy(sortedMethods, methods)
|
||||
sort.Sort(sort.StringSlice(sortedMethods))
|
||||
sort.Strings(sortedMethods)
|
||||
if !reflect.DeepEqual(sortedMethods, methods) {
|
||||
t.Fatal("RegisteredCmdMethods: methods are not sorted")
|
||||
}
|
||||
|
|
|
@ -643,9 +643,9 @@ func TestFailureScenarios(t *testing.T) {
|
|||
// context.
|
||||
maxSize := int64(-1)
|
||||
if maxFileSize, ok := tc.maxFileSizes[fileNum]; ok {
|
||||
maxSize = int64(maxFileSize)
|
||||
maxSize = maxFileSize
|
||||
}
|
||||
file := &mockFile{maxSize: int64(maxSize)}
|
||||
file := &mockFile{maxSize: maxSize}
|
||||
tc.files[fileNum] = &lockableFile{file: file}
|
||||
return file, nil
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/bash
|
||||
# The script does automatic checking on a Go package and its sub-packages, including:
|
||||
# 1. gofmt (http://golang.org/cmd/gofmt/)
|
||||
# 2. golint (https://github.com/golang/lint)
|
||||
# 3. go vet (http://golang.org/cmd/vet)
|
||||
# 4. gosimple (https://github.com/dominikh/go-simple)
|
||||
# 5. unconvert (https://github.com/mdempsky/unconvert)
|
||||
|
@ -14,8 +13,6 @@ go test -tags="rpctest" ./...
|
|||
# Automatic checks
|
||||
golangci-lint run --deadline=10m --disable-all \
|
||||
--enable=gofmt \
|
||||
--enable=golint \
|
||||
--enable=vet \
|
||||
--enable=gosimple \
|
||||
--enable=unconvert
|
||||
|
||||
|
|
|
@ -818,7 +818,7 @@ func (c *helpCacher) rpcUsage(includeWebsockets bool) (string, error) {
|
|||
}
|
||||
}
|
||||
|
||||
sort.Sort(sort.StringSlice(usageTexts))
|
||||
sort.Strings(usageTexts)
|
||||
c.usage = strings.Join(usageTexts, "\n")
|
||||
return c.usage, nil
|
||||
}
|
||||
|
|
|
@ -2270,10 +2270,8 @@ out:
|
|||
// When an InvVect has been added to a block, we can
|
||||
// now remove it, if it was present.
|
||||
case broadcastInventoryDel:
|
||||
if _, ok := pendingInvs[*msg]; ok {
|
||||
delete(pendingInvs, *msg)
|
||||
}
|
||||
}
|
||||
|
||||
case <-timer.C:
|
||||
// Any inventory we have has not made it into a block
|
||||
|
|
|
@ -124,7 +124,7 @@ func TestOpcodeDisasm(t *testing.T) {
|
|||
|
||||
// OP_UNKNOWN#.
|
||||
case opcodeVal >= 0xba && opcodeVal <= 0xf9 || opcodeVal == 0xfc:
|
||||
expectedStr = "OP_UNKNOWN" + strconv.Itoa(int(opcodeVal))
|
||||
expectedStr = "OP_UNKNOWN" + strconv.Itoa(opcodeVal)
|
||||
}
|
||||
|
||||
pop := parsedOpcode{opcode: &opcodeArray[opcodeVal], data: data}
|
||||
|
@ -190,7 +190,7 @@ func TestOpcodeDisasm(t *testing.T) {
|
|||
|
||||
// OP_UNKNOWN#.
|
||||
case opcodeVal >= 0xba && opcodeVal <= 0xf9 || opcodeVal == 0xfc:
|
||||
expectedStr = "OP_UNKNOWN" + strconv.Itoa(int(opcodeVal))
|
||||
expectedStr = "OP_UNKNOWN" + strconv.Itoa(opcodeVal)
|
||||
}
|
||||
|
||||
pop := parsedOpcode{opcode: &opcodeArray[opcodeVal], data: data}
|
||||
|
|
|
@ -118,15 +118,15 @@ func TestElementWire(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
ServiceFlag(SFNodeNetwork),
|
||||
SFNodeNetwork,
|
||||
[]byte{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
},
|
||||
{
|
||||
InvType(InvTypeTx),
|
||||
InvTypeTx,
|
||||
[]byte{0x01, 0x00, 0x00, 0x00},
|
||||
},
|
||||
{
|
||||
BitcoinNet(MainNet),
|
||||
MainNet,
|
||||
[]byte{0xf9, 0xbe, 0xb4, 0xd9},
|
||||
},
|
||||
// Type not supported by the "fast" path and requires reflection.
|
||||
|
@ -211,9 +211,9 @@ func TestElementWireErrors(t *testing.T) {
|
|||
}),
|
||||
0, io.ErrShortWrite, io.EOF,
|
||||
},
|
||||
{ServiceFlag(SFNodeNetwork), 0, io.ErrShortWrite, io.EOF},
|
||||
{InvType(InvTypeTx), 0, io.ErrShortWrite, io.EOF},
|
||||
{BitcoinNet(MainNet), 0, io.ErrShortWrite, io.EOF},
|
||||
{SFNodeNetwork, 0, io.ErrShortWrite, io.EOF},
|
||||
{InvTypeTx, 0, io.ErrShortWrite, io.EOF},
|
||||
{MainNet, 0, io.ErrShortWrite, io.EOF},
|
||||
}
|
||||
|
||||
t.Logf("Running %d tests", len(tests))
|
||||
|
|
Loading…
Reference in a new issue