diff --git a/ledger/allegra/rules_test.go b/ledger/allegra/rules_test.go index 1f2dc283..d24ee4ca 100644 --- a/ledger/allegra/rules_test.go +++ b/ledger/allegra/rules_test.go @@ -17,7 +17,7 @@ package allegra_test import ( "crypto/rand" "encoding/hex" - "fmt" + "errors" "testing" "github.com/blinklabs-io/gouroboros/ledger/allegra" @@ -48,7 +48,7 @@ func (ls testLedgerState) UtxoById( } return tmpUtxo, nil } - return common.Utxo{}, fmt.Errorf("not found") + return common.Utxo{}, errors.New("not found") } func TestUtxoValidateOutsideValidityIntervalUtxo(t *testing.T) { diff --git a/ledger/mary/rules_test.go b/ledger/mary/rules_test.go index f6ba0a3e..ce8ac5b8 100644 --- a/ledger/mary/rules_test.go +++ b/ledger/mary/rules_test.go @@ -17,7 +17,7 @@ package mary_test import ( "crypto/rand" "encoding/hex" - "fmt" + "errors" "testing" "github.com/blinklabs-io/gouroboros/cbor" @@ -50,7 +50,7 @@ func (ls testLedgerState) UtxoById( } return tmpUtxo, nil } - return common.Utxo{}, fmt.Errorf("not found") + return common.Utxo{}, errors.New("not found") } func TestUtxoValidateOutsideValidityIntervalUtxo(t *testing.T) { diff --git a/ledger/shelley/rules_test.go b/ledger/shelley/rules_test.go index 030cfc87..736ab163 100644 --- a/ledger/shelley/rules_test.go +++ b/ledger/shelley/rules_test.go @@ -17,7 +17,7 @@ package shelley_test import ( "crypto/rand" "encoding/hex" - "fmt" + "errors" "testing" "github.com/blinklabs-io/gouroboros/ledger/common" @@ -47,7 +47,7 @@ func (ls testLedgerState) UtxoById( } return tmpUtxo, nil } - return common.Utxo{}, fmt.Errorf("not found") + return common.Utxo{}, errors.New("not found") } func TestUtxoValidateTimeToLive(t *testing.T) { diff --git a/protocol/handshake/client_test.go b/protocol/handshake/client_test.go index 2baea06a..edf9cfe2 100644 --- a/protocol/handshake/client_test.go +++ b/protocol/handshake/client_test.go @@ -248,7 +248,7 @@ func TestClientNtNAcceptV11(t *testing.T) { func TestClientNtCRefuseVersionMismatch(t *testing.T) { defer goleak.VerifyNone(t) - expectedErr := fmt.Sprintf("%s: version mismatch", handshake.ProtocolName) + expectedErr := handshake.ProtocolName + ": version mismatch" mockConn := ouroboros_mock.NewConnection( ouroboros_mock.ProtocolRoleClient, []ouroboros_mock.ConversationEntry{ @@ -282,7 +282,7 @@ func TestClientNtCRefuseVersionMismatch(t *testing.T) { func TestClientNtCRefuseDecodeError(t *testing.T) { defer goleak.VerifyNone(t) - expectedErr := fmt.Sprintf("%s: decode error: foo", handshake.ProtocolName) + expectedErr := handshake.ProtocolName + ": decode error: foo" mockConn := ouroboros_mock.NewConnection( ouroboros_mock.ProtocolRoleClient, []ouroboros_mock.ConversationEntry{ @@ -317,7 +317,7 @@ func TestClientNtCRefuseDecodeError(t *testing.T) { func TestClientNtCRefuseRefused(t *testing.T) { defer goleak.VerifyNone(t) - expectedErr := fmt.Sprintf("%s: refused: foo", handshake.ProtocolName) + expectedErr := handshake.ProtocolName + ": refused: foo" mockConn := ouroboros_mock.NewConnection( ouroboros_mock.ProtocolRoleClient, []ouroboros_mock.ConversationEntry{ diff --git a/protocol/handshake/server_test.go b/protocol/handshake/server_test.go index f3692144..998e103a 100644 --- a/protocol/handshake/server_test.go +++ b/protocol/handshake/server_test.go @@ -1,4 +1,4 @@ -// Copyright 2023 Blink Labs Software +// Copyright 2025 Blink Labs Software // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ package handshake_test import ( + "errors" "fmt" "testing" "time" @@ -97,9 +98,7 @@ func TestServerHandshakeRefuseVersionMismatch(t *testing.T) { defer func() { goleak.VerifyNone(t) }() - expectedErr := fmt.Errorf( - "handshake failed: refused due to version mismatch", - ) + expectedErr := errors.New("handshake failed: refused due to version mismatch") mockConn := ouroboros_mock.NewConnection( ouroboros_mock.ProtocolRoleServer, []ouroboros_mock.ConversationEntry{ diff --git a/protocol/keepalive/client_test.go b/protocol/keepalive/client_test.go index dda2004b..85a7e075 100644 --- a/protocol/keepalive/client_test.go +++ b/protocol/keepalive/client_test.go @@ -1,4 +1,4 @@ -// Copyright 2023 Blink Labs Software +// Copyright 2025 Blink Labs Software // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ package keepalive_test import ( + "errors" "fmt" "testing" "time" @@ -142,7 +143,7 @@ func TestServerKeepaliveHandlingWithWrongResponse(t *testing.T) { go func() { err := <-mockConn.ErrorChan() if err == nil { - asyncErrChan <- fmt.Errorf("did not receive expected error") + asyncErrChan <- errors.New("did not receive expected error") } else { if err.Error() != expectedErr { asyncErrChan <- fmt.Errorf("did not receive expected error\n got: %s\n wanted: %s", err, expectedErr) diff --git a/protocol/localtxsubmission/client_test.go b/protocol/localtxsubmission/client_test.go index 63dcdaed..6c038395 100644 --- a/protocol/localtxsubmission/client_test.go +++ b/protocol/localtxsubmission/client_test.go @@ -1,4 +1,4 @@ -// Copyright 2024 Blink Labs Software +// Copyright 2025 Blink Labs Software // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ package localtxsubmission_test import ( + "errors" "fmt" "testing" "time" @@ -129,7 +130,7 @@ func TestSubmitTxRject(t *testing.T) { expectedErr := localtxsubmission.TransactionRejectedError{ // [0, [1, ["foo"]]] ReasonCbor: test.DecodeHexString("820082018163666f6f"), - Reason: fmt.Errorf("GenericError ([0 [1 [foo]]])"), + Reason: errors.New("GenericError ([0 [1 [foo]]])"), } conversation := append( conversationHandshakeSubmitTx,