Fix all lint errors

This commit is contained in:
9seconds
2018-05-31 09:54:20 +03:00
parent 42e5be36bf
commit 4ad913add2
12 changed files with 101 additions and 47 deletions
+5
View File
@@ -6,6 +6,8 @@ import (
"go.uber.org/zap"
)
// LogReadWriteCloser adds additional logging for reading/writing. All
// logging is performed for debug mode only.
type LogReadWriteCloser struct {
conn io.ReadWriteCloser
logger *zap.SugaredLogger
@@ -13,18 +15,21 @@ type LogReadWriteCloser struct {
name string
}
// Read reads from connection
func (l *LogReadWriteCloser) Read(p []byte) (n int, err error) {
n, err = l.conn.Read(p)
l.logger.Debugw("Finish reading", "name", l.name, "socketid", l.sockid, "nbytes", n, "error", err)
return
}
// Write writes into connection.
func (l *LogReadWriteCloser) Write(p []byte) (n int, err error) {
n, err = l.conn.Write(p)
l.logger.Debugw("Finish writing", "name", l.name, "socketid", l.sockid, "nbytes", n, "error", err)
return
}
// Close closes underlying connection.
func (l *LogReadWriteCloser) Close() error {
err := l.conn.Close()
l.logger.Debugw("Finish closing socket", "name", l.name, "socketid", l.sockid, "error", err)