From ea3d820df9aafc30096b32f8eb70878c626022a4 Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sat, 30 Jul 2022 01:31:36 +0200 Subject: [PATCH] micro-optimization: use int8 for enums (#338) --- asciiconverter.go | 2 +- client_handler.go | 6 +++--- driver.go | 4 ++-- driver_test.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/asciiconverter.go b/asciiconverter.go index 4be732a7..ec5d0cb7 100644 --- a/asciiconverter.go +++ b/asciiconverter.go @@ -5,7 +5,7 @@ import ( "io" ) -type convertMode int +type convertMode int8 const ( convertModeToCRLF convertMode = iota diff --git a/client_handler.go b/client_handler.go index 780163cc..a7dcfeed 100644 --- a/client_handler.go +++ b/client_handler.go @@ -14,7 +14,7 @@ import ( ) // HASHAlgo is the enumerable that represents the supported HASH algorithms -type HASHAlgo int +type HASHAlgo int8 // Supported hash algorithms const ( @@ -26,7 +26,7 @@ const ( ) // TransferType is the enumerable that represents the supported transfer types -type TransferType int +type TransferType int8 // Supported transfer type const ( @@ -35,7 +35,7 @@ const ( ) // DataChannel is the enumerable that represents the data channel (active or passive) -type DataChannel int +type DataChannel int8 // Supported data channel types const ( diff --git a/driver.go b/driver.go index 88d242be..e9696867 100644 --- a/driver.go +++ b/driver.go @@ -208,7 +208,7 @@ type PortRange struct { type PublicIPResolver func(ClientContext) (string, error) // TLSRequirement is the enumerable that represents the supported TLS mode -type TLSRequirement int +type TLSRequirement int8 // TLS modes const ( @@ -219,7 +219,7 @@ const ( // DataConnectionRequirement is the enumerable that represents the supported // protection mode for data channels -type DataConnectionRequirement int +type DataConnectionRequirement int8 // Supported data connection requirements const ( diff --git a/driver_test.go b/driver_test.go index 4592571b..75935bab 100644 --- a/driver_test.go +++ b/driver_test.go @@ -17,7 +17,7 @@ import ( "github.com/spf13/afero" ) -type tlsVerificationReply int +type tlsVerificationReply int8 const ( // tls certificate is ok but a password is required too