From 483a56c8473fce16b4b00910456575a5ace42426 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Sat, 26 May 2018 00:47:51 +0200 Subject: [PATCH] adjust lint settings --- .vscode/settings.json | 6 +++++- app/commander/outbound.go | 6 +++--- app/log/log.go | 4 ++-- common/common.go | 3 --- proxy/vmess/encoding/server.go | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index b204aa45..1ba6d541 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,7 +4,11 @@ "go.lintTool": "gometalinter", "go.lintFlags": [ - "--enable-gc" + "--enable-gc", + "--no-config", + "--exclude=.*\\.pb\\.go", + "--concurrency=2", + "--disable=gas" ], "go.formatTool": "goimports", diff --git a/app/commander/outbound.go b/app/commander/outbound.go index a5886060..ab04c96a 100644 --- a/app/commander/outbound.go +++ b/app/commander/outbound.go @@ -21,9 +21,9 @@ func (l *OutboundListener) add(conn net.Conn) { select { case l.buffer <- conn: case <-l.done.Wait(): - common.Ignore(conn.Close(), "We can do nothing if Close() returns error.") + conn.Close() // nolint: errcheck default: - common.Ignore(conn.Close(), "We can do nothing if Close() returns error.") + conn.Close() // nolint: errcheck } } @@ -44,7 +44,7 @@ L: for { select { case c := <-l.buffer: - common.Ignore(c.Close(), "We can do nothing if errored.") + c.Close() // nolint: errcheck default: break L } diff --git a/app/log/log.go b/app/log/log.go index 684fa0bf..d8b6afd1 100644 --- a/app/log/log.go +++ b/app/log/log.go @@ -138,10 +138,10 @@ func (g *Instance) Close() error { g.active = false - common.Ignore(common.Close(g.accessLogger), "Recycling it anyway") + common.Close(g.accessLogger) // nolint: errcheck g.accessLogger = nil - common.Ignore(common.Close(g.errorLogger), "Recycling this too") + common.Close(g.errorLogger) // nolint: errcheck g.errorLogger = nil return nil diff --git a/common/common.go b/common/common.go index 82524b8f..2f58ba7f 100644 --- a/common/common.go +++ b/common/common.go @@ -21,6 +21,3 @@ func Must2(v interface{}, err error) interface{} { func Error2(v interface{}, err error) error { return err } - -// Ignore an error with reason, for lint purpose. -func Ignore(err error, reason string) {} diff --git a/proxy/vmess/encoding/server.go b/proxy/vmess/encoding/server.go index 363edd11..0071f15d 100644 --- a/proxy/vmess/encoding/server.go +++ b/proxy/vmess/encoding/server.go @@ -176,7 +176,7 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.Request if invalidRequestErr != nil { randomLen := dice.Roll(64) + 1 // Read random number of bytes for prevent detection. - common.Ignore(buffer.AppendSupplier(buf.ReadFullFrom(decryptor, int32(randomLen))), "Error doesn't matter") + buffer.AppendSupplier(buf.ReadFullFrom(decryptor, int32(randomLen))) // nolint: errcheck } }()