multi: remove superfluous fmt.Sprintf
build: bump golangci-lint to 1.24.0
This commit is contained in:
parent
52d2d2db29
commit
be680db523
2
.github/workflows/go.yml
vendored
2
.github/workflows/go.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v1
|
||||
- name: Install Linters
|
||||
run: "curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.6"
|
||||
run: "curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0"
|
||||
- name: Build
|
||||
env:
|
||||
GO111MODULE: "on"
|
||||
|
||||
@ -497,7 +497,7 @@ func SStxNullOutputAmounts(amounts []int64,
|
||||
}
|
||||
|
||||
if amountTicket <= 0 {
|
||||
errStr := fmt.Sprintf("committed amount was too small!")
|
||||
errStr := "committed amount was too small!"
|
||||
return 0, nil, stakeRuleError(ErrSStxBadCommitAmount, errStr)
|
||||
}
|
||||
|
||||
|
||||
@ -25,22 +25,22 @@ func blockOneCoinbasePaysTokens(tx *dcrutil.Tx, params *chaincfg.Params) error {
|
||||
}
|
||||
|
||||
if tx.MsgTx().LockTime != 0 {
|
||||
str := fmt.Sprintf("block 1 coinbase has invalid locktime")
|
||||
str := "block 1 coinbase has invalid locktime"
|
||||
return ruleError(ErrBlockOneTx, str)
|
||||
}
|
||||
|
||||
if tx.MsgTx().Expiry != wire.NoExpiryValue {
|
||||
str := fmt.Sprintf("block 1 coinbase has invalid expiry")
|
||||
str := "block 1 coinbase has invalid expiry"
|
||||
return ruleError(ErrBlockOneTx, str)
|
||||
}
|
||||
|
||||
if tx.MsgTx().TxIn[0].Sequence != wire.MaxTxInSequenceNum {
|
||||
str := fmt.Sprintf("block 1 coinbase not finalized")
|
||||
str := "block 1 coinbase not finalized"
|
||||
return ruleError(ErrBlockOneInputs, str)
|
||||
}
|
||||
|
||||
if len(tx.MsgTx().TxOut) == 0 {
|
||||
str := fmt.Sprintf("coinbase outputs empty in block 1")
|
||||
str := "coinbase outputs empty in block 1"
|
||||
return ruleError(ErrBlockOneOutputs, str)
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ func coinbasePaysTreasury(subsidyCache *standalone.SubsidyCache, tx *dcrutil.Tx,
|
||||
}
|
||||
|
||||
if len(tx.MsgTx().TxOut) == 0 {
|
||||
str := fmt.Sprintf("invalid coinbase (no outputs)")
|
||||
str := "invalid coinbase (no outputs)"
|
||||
return ruleError(ErrNoTxOutputs, str)
|
||||
}
|
||||
|
||||
|
||||
@ -90,43 +90,43 @@ func schnorrPartialSign(msg []byte, priv []byte,
|
||||
curve := Edwards()
|
||||
privBig := new(big.Int).SetBytes(priv)
|
||||
if privBig.Cmp(zero) == 0 {
|
||||
str := fmt.Sprintf("priv scalar is zero")
|
||||
str := "priv scalar is zero"
|
||||
return nil, nil, fmt.Errorf("%v", str)
|
||||
}
|
||||
if privBig.Cmp(curve.N) >= 0 {
|
||||
str := fmt.Sprintf("priv scalar is out of bounds")
|
||||
str := "priv scalar is out of bounds"
|
||||
return nil, nil, fmt.Errorf("%v", str)
|
||||
}
|
||||
zeroBigInt(privBig)
|
||||
|
||||
privNonceBig := new(big.Int).SetBytes(privNonce)
|
||||
if privNonceBig.Cmp(zero) == 0 {
|
||||
str := fmt.Sprintf("privNonce scalar is zero")
|
||||
str := "privNonce scalar is zero"
|
||||
return nil, nil, fmt.Errorf("%v", str)
|
||||
}
|
||||
if privNonceBig.Cmp(curve.N) >= 0 {
|
||||
str := fmt.Sprintf("privNonce scalar is out of bounds")
|
||||
str := "privNonce scalar is out of bounds"
|
||||
return nil, nil, fmt.Errorf("%v", str)
|
||||
}
|
||||
zeroBigInt(privNonceBig)
|
||||
|
||||
gpkX, gpkY, err := curve.encodedBytesToBigIntPoint(copyBytes(groupPublicKey))
|
||||
if err != nil {
|
||||
str := fmt.Sprintf("public key point could not be decoded")
|
||||
str := fmt.Sprintf("public key point could not be decoded: %v", err)
|
||||
return nil, nil, fmt.Errorf("%v", str)
|
||||
}
|
||||
if !curve.IsOnCurve(gpkX, gpkY) {
|
||||
str := fmt.Sprintf("public key sum is off curve")
|
||||
str := "public key sum is off curve"
|
||||
return nil, nil, fmt.Errorf("%v", str)
|
||||
}
|
||||
|
||||
gpnX, gpnY, err := curve.encodedBytesToBigIntPoint(copyBytes(pubNonceSum))
|
||||
if err != nil {
|
||||
str := fmt.Sprintf("public key point could not be decoded")
|
||||
str := fmt.Sprintf("public key point could not be decoded: %v", err)
|
||||
return nil, nil, fmt.Errorf("%v", str)
|
||||
}
|
||||
if !curve.IsOnCurve(gpnX, gpnY) {
|
||||
str := fmt.Sprintf("public key sum is off curve")
|
||||
str := "public key sum is off curve"
|
||||
return nil, nil, fmt.Errorf("%v", str)
|
||||
}
|
||||
|
||||
|
||||
@ -92,12 +92,12 @@ func schnorrVerify(sig *Signature, pubkey *secp256k1.PublicKey, msg []byte) (boo
|
||||
}
|
||||
|
||||
if pubkey == nil {
|
||||
str := fmt.Sprintf("nil pubkey")
|
||||
str := "nil pubkey"
|
||||
return false, schnorrError(ErrInputValue, str)
|
||||
}
|
||||
|
||||
if !curve.IsOnCurve(pubkey.X(), pubkey.Y()) {
|
||||
str := fmt.Sprintf("pubkey point is not on curve")
|
||||
str := "pubkey point is not on curve"
|
||||
return false, schnorrError(ErrPointNotOnCurve, str)
|
||||
}
|
||||
|
||||
@ -111,23 +111,23 @@ func schnorrVerify(sig *Signature, pubkey *secp256k1.PublicKey, msg []byte) (boo
|
||||
// If the hash ends up larger than the order of the curve, abort.
|
||||
// Same thing for hash == 0 (as unlikely as that is...).
|
||||
if hBig.Cmp(curve.N) >= 0 {
|
||||
str := fmt.Sprintf("hash of (R || m) too big")
|
||||
str := "hash of (R || m) too big"
|
||||
return false, schnorrError(ErrSchnorrHashValue, str)
|
||||
}
|
||||
if hBig.Cmp(bigZero) == 0 {
|
||||
str := fmt.Sprintf("hash of (R || m) is zero value")
|
||||
str := "hash of (R || m) is zero value"
|
||||
return false, schnorrError(ErrSchnorrHashValue, str)
|
||||
}
|
||||
|
||||
// We also can't have s greater than the order of the curve.
|
||||
if sig.s.Cmp(curve.N) >= 0 {
|
||||
str := fmt.Sprintf("s value is too big")
|
||||
str := "s value is too big"
|
||||
return false, schnorrError(ErrInputValue, str)
|
||||
}
|
||||
|
||||
// r can't be larger than the curve prime.
|
||||
if sig.r.Cmp(curve.P) == 1 {
|
||||
str := fmt.Sprintf("given R was greater than curve prime")
|
||||
str := "given R was greater than curve prime"
|
||||
return false, schnorrError(ErrBadSigRNotOnCurve, str)
|
||||
}
|
||||
|
||||
@ -138,18 +138,18 @@ func schnorrVerify(sig *Signature, pubkey *secp256k1.PublicKey, msg []byte) (boo
|
||||
rlx, rly := curve.Add(lx, ly, rx, ry)
|
||||
|
||||
if rly.Bit(0) == 1 {
|
||||
str := fmt.Sprintf("calculated R y-value was odd")
|
||||
str := "calculated R y-value is odd"
|
||||
return false, schnorrError(ErrBadSigRYValue, str)
|
||||
}
|
||||
if !curve.IsOnCurve(rlx, rly) {
|
||||
str := fmt.Sprintf("calculated R point was not on curve")
|
||||
str := "calculated R point is not on curve"
|
||||
return false, schnorrError(ErrBadSigRNotOnCurve, str)
|
||||
}
|
||||
rlxB := bigIntToEncodedBytes(rlx)
|
||||
|
||||
// r == r' --> valid signature
|
||||
if !bytes.Equal(rBytes[:], rlxB[:]) {
|
||||
str := fmt.Sprintf("calculated R point was not given R")
|
||||
str := "calculated R point was not given R"
|
||||
return false, schnorrError(ErrUnequalRValues, str)
|
||||
}
|
||||
|
||||
@ -221,19 +221,19 @@ func schnorrSign(msg []byte, ps []byte, k []byte) (*Signature, error) {
|
||||
bigK := new(big.Int).SetBytes(k)
|
||||
|
||||
if psBig.Cmp(bigZero) == 0 {
|
||||
str := fmt.Sprintf("secret scalar is zero")
|
||||
str := "secret scalar is zero"
|
||||
return nil, schnorrError(ErrInputValue, str)
|
||||
}
|
||||
if psBig.Cmp(curve.N) >= 0 {
|
||||
str := fmt.Sprintf("secret scalar is out of bounds")
|
||||
str := "secret scalar is out of bounds"
|
||||
return nil, schnorrError(ErrInputValue, str)
|
||||
}
|
||||
if bigK.Cmp(bigZero) == 0 {
|
||||
str := fmt.Sprintf("k scalar is zero")
|
||||
str := "k scalar is zero"
|
||||
return nil, schnorrError(ErrInputValue, str)
|
||||
}
|
||||
if bigK.Cmp(curve.N) >= 0 {
|
||||
str := fmt.Sprintf("k scalar is out of bounds")
|
||||
str := "k scalar is out of bounds"
|
||||
return nil, schnorrError(ErrInputValue, str)
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ func schnorrSign(msg []byte, ps []byte, k []byte) (*Signature, error) {
|
||||
|
||||
// If the hash ends up larger than the order of the curve, abort.
|
||||
if hBig.Cmp(curve.N) >= 0 {
|
||||
str := fmt.Sprintf("hash of (R || m) too big")
|
||||
str := "hash of (R || m) too big"
|
||||
return nil, schnorrError(ErrSchnorrHashValue, str)
|
||||
}
|
||||
|
||||
|
||||
@ -5130,7 +5130,7 @@ func (s *rpcServer) processRequest(ctx context.Context, request *dcrjson.Request
|
||||
if request.Method == "" || request.Params == nil {
|
||||
jsonErr = &dcrjson.RPCError{
|
||||
Code: dcrjson.ErrRPCInvalidRequest.Code,
|
||||
Message: fmt.Sprintf("Invalid request: malformed"),
|
||||
Message: "Invalid request: malformed",
|
||||
}
|
||||
msg, err := createMarshalledReply(request.Jsonrpc, request.ID, result, jsonErr)
|
||||
if err != nil {
|
||||
@ -5285,7 +5285,7 @@ func (s *rpcServer) jsonRPCRead(sCtx context.Context, w http.ResponseWriter, r *
|
||||
if len(batchedRequests) == 0 {
|
||||
jsonErr := &dcrjson.RPCError{
|
||||
Code: dcrjson.ErrRPCInvalidRequest.Code,
|
||||
Message: fmt.Sprint("Invalid request: empty batch"),
|
||||
Message: "Invalid request: empty batch",
|
||||
}
|
||||
resp, err = dcrjson.MarshalResponse("2.0", nil, nil, jsonErr)
|
||||
if err != nil {
|
||||
|
||||
@ -1517,7 +1517,7 @@ out:
|
||||
if req.Method == "" || req.Params == nil {
|
||||
jsonErr := &dcrjson.RPCError{
|
||||
Code: dcrjson.ErrRPCInvalidRequest.Code,
|
||||
Message: fmt.Sprintf("Invalid request: malformed"),
|
||||
Message: "Invalid request: malformed",
|
||||
}
|
||||
reply, err := createMarshalledReply(req.Jsonrpc, req.ID, nil, jsonErr)
|
||||
if err != nil {
|
||||
@ -1679,7 +1679,7 @@ out:
|
||||
|
||||
jsonErr := &dcrjson.RPCError{
|
||||
Code: dcrjson.ErrRPCInvalidRequest.Code,
|
||||
Message: fmt.Sprint("Invalid request: empty batch"),
|
||||
Message: "Invalid request: empty batch",
|
||||
}
|
||||
reply, err = dcrjson.MarshalResponse("2.0", nil, nil, jsonErr)
|
||||
if err != nil {
|
||||
@ -1748,7 +1748,7 @@ out:
|
||||
if req.Method == "" || req.Params == nil {
|
||||
jsonErr := &dcrjson.RPCError{
|
||||
Code: dcrjson.ErrRPCInvalidRequest.Code,
|
||||
Message: fmt.Sprintf("Invalid request: malformed"),
|
||||
Message: "Invalid request: malformed",
|
||||
}
|
||||
reply, err := createMarshalledReply(req.Jsonrpc, req.ID, nil, jsonErr)
|
||||
if err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user