mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 15:44:01 +03:00
Fix all lint errors
This commit is contained in:
+7
-2
@@ -6,22 +6,27 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// TimeoutReadWriteCloser sets timeouts for read/write into underlying
|
||||
// network connection.
|
||||
type TimeoutReadWriteCloser struct {
|
||||
conn net.Conn
|
||||
readTimeout time.Duration
|
||||
writeTimeout time.Duration
|
||||
}
|
||||
|
||||
// Read reads from connection
|
||||
func (t *TimeoutReadWriteCloser) Read(p []byte) (int, error) {
|
||||
t.conn.SetReadDeadline(time.Now().Add(t.readTimeout))
|
||||
t.conn.SetReadDeadline(time.Now().Add(t.readTimeout)) // nolint: errcheck, gas
|
||||
return t.conn.Read(p)
|
||||
}
|
||||
|
||||
// Write writes into connection.
|
||||
func (t *TimeoutReadWriteCloser) Write(p []byte) (int, error) {
|
||||
t.conn.SetWriteDeadline(time.Now().Add(t.writeTimeout))
|
||||
t.conn.SetWriteDeadline(time.Now().Add(t.writeTimeout)) // nolint: errcheck, gas
|
||||
return t.conn.Write(p)
|
||||
}
|
||||
|
||||
// Close closes underlying connection.
|
||||
func (t *TimeoutReadWriteCloser) Close() error {
|
||||
return t.conn.Close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user