From 48deeb47a38e8baf4b2183f8960185b63dabe658 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Thu, 7 Jan 2016 10:08:59 -0500 Subject: [PATCH] golint cmux.go:28:1: exported method ErrNotMatched.Temporary should have comment or be unexported cmux.go:29:1: exported method ErrNotMatched.Timeout should have comment or be unexported cmux.go:38:2: exported var ErrListenerClosed should have comment or be unexported cmux.go:165:6: exported type MuxConn should have comment or be unexported --- .travis.yml | 6 ++++++ cmux.go | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4adcaca..2d407fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,3 +3,9 @@ language: go go: - 1.3 - 1.4 + +before_install: + - go get -u github.com/golang/lint/golint + +before_script: + - golint ./... diff --git a/cmux.go b/cmux.go index 37c0753..1143453 100644 --- a/cmux.go +++ b/cmux.go @@ -13,6 +13,8 @@ type Matcher func(r io.Reader) (ok bool) // the mux should continue serving the listener. type ErrorHandler func(err error) (ok bool) +var _ net.Error = ErrNotMatched{} + // ErrNotMatched is returned whenever a connection is not matched by any of // the matchers registered in the multiplexer. type ErrNotMatched struct { @@ -24,8 +26,11 @@ func (e ErrNotMatched) Error() string { e.c.RemoteAddr()) } +// Temporary implements the net.Error interface. func (e ErrNotMatched) Temporary() bool { return true } -func (e ErrNotMatched) Timeout() bool { return false } + +// Timeout implements the net.Error interface. +func (e ErrNotMatched) Timeout() bool { return false } type errListenerClosed string @@ -34,6 +39,8 @@ func (e errListenerClosed) Temporary() bool { return false } func (e errListenerClosed) Timeout() bool { return false } var ( + // ErrListenerClosed is returned from muxListener.Accept when the underlying + // listener is closed. ErrListenerClosed = errListenerClosed("mux: listener closed") ) @@ -157,6 +164,7 @@ func (l muxListener) Accept() (c net.Conn, err error) { } } +// MuxConn wraps a net.Conn and provides transparent sniffing of connection data. type MuxConn struct { net.Conn buf buffer