From d603d20087e933a8e40413bfe526629dddb477c6 Mon Sep 17 00:00:00 2001 From: John Westcott IV Date: Tue, 9 Nov 2021 15:15:08 -0500 Subject: [PATCH] Fixing linting issues --- pkg/netceptor/netceptor.go | 3 ++- pkg/netceptor/netceptor_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/netceptor/netceptor.go b/pkg/netceptor/netceptor.go index 8e5fee2a4..6382580a6 100644 --- a/pkg/netceptor/netceptor.go +++ b/pkg/netceptor/netceptor.go @@ -443,10 +443,11 @@ func (s *Netceptor) MaxConnectionIdleTime() time.Duration { // Convert the connection type to a string. func (s *Netceptor) GetConnectionTypeAsString(connectionType byte) string { - // A byte can't be < 0 so we don't need to check the lower bounds + // A byte can't be < 0 so we don't need to check the lower bounds if connectionType < byte(len(ConnTypeStrings)) { return ConnTypeStrings[connectionType] } + return "Unknown" } diff --git a/pkg/netceptor/netceptor_test.go b/pkg/netceptor/netceptor_test.go index 7c355a978..dda2fae8b 100644 --- a/pkg/netceptor/netceptor_test.go +++ b/pkg/netceptor/netceptor_test.go @@ -798,7 +798,7 @@ func TestConnTypeString(t *testing.T) { if ConnTypeStrings[ConnTypeDatagram] != n1.GetConnectionTypeAsString(0) { t.Fatal("Datagram should be the first entry in ConnTypeStrings") } - if "Unknown" != n1.GetConnectionTypeAsString(254) { + if n1.GetConnectionTypeAsString(254) != "Unknown" { t.Fatal("Either we now have 254 ConnTypes or GetConnectionTypeAsString did not properly return Unknown") } // Shutdown the network