ax(node): remove banned fmt import from protocol_test.go
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

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 <charon@lethean.io>
This commit is contained in:
Claude 2026-04-02 08:22:25 +01:00
parent 7396ef0253
commit b0dcb18d76
No known key found for this signature in database
GPG key ID: AF404715446AEB41

View file

@ -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")
}