From 583ad442c14ebce138cc34204fd7173ac7993f51 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 9 Feb 2023 19:22:51 +0100 Subject: [PATCH] Replace closable interface by io.Closer There is no need to define a custom interface. --- gather.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gather.go b/gather.go index 355592c..9c90eaa 100644 --- a/gather.go +++ b/gather.go @@ -5,6 +5,7 @@ import ( "crypto/tls" "errors" "fmt" + "io" "net" "reflect" "sync" @@ -20,12 +21,8 @@ const ( stunGatherTimeout = time.Second * 5 ) -type closeable interface { - Close() error -} - // Close a net.Conn and log if we have a failure -func closeConnAndLog(c closeable, log logging.LeveledLogger, msg string) { +func closeConnAndLog(c io.Closer, log logging.LeveledLogger, msg string) { if c == nil || (reflect.ValueOf(c).Kind() == reflect.Ptr && reflect.ValueOf(c).IsNil()) { log.Warnf("Conn is not allocated (%s)", msg) return