From b0dcb18d76e8d5e5b20f577536eaf32bcac278d4 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 2 Apr 2026 08:22:25 +0100 Subject: [PATCH] ax(node): remove banned fmt import from protocol_test.go Replace fmt.Errorf with a local testErr type to eliminate the banned fmt import. The type carries its own usage example comment per AX Principle 2. Co-Authored-By: Charon --- pkg/node/protocol_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/node/protocol_test.go b/pkg/node/protocol_test.go index 1d728a4..c20c5c2 100644 --- a/pkg/node/protocol_test.go +++ b/pkg/node/protocol_test.go @@ -1,7 +1,6 @@ package node import ( - "fmt" "testing" ) @@ -153,8 +152,14 @@ func TestConvenienceFunctions(t *testing.T) { } } +// testErr is a plain error type used to verify behaviour with non-ProtocolError values. +// err := &testErr{"context: operation failed"} +type testErr struct{ message string } + +func (e *testErr) Error() string { return e.message } + func TestGetProtocolErrorCode_NonProtocolError(t *testing.T) { - err := fmt.Errorf("regular error") + err := &testErr{"regular error"} if GetProtocolErrorCode(err) != 0 { t.Error("Expected 0 for non-ProtocolError") }