From 67f5292f38a2e50993514cd002a274c4cc900479 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Fri, 25 May 2018 23:20:24 +0200 Subject: [PATCH] fix lint errors --- app/log/command/command.go | 1 + app/log/log.go | 4 ++-- app/proxyman/errors.generated.go | 7 ------- app/proxyman/proxyman.go | 2 -- app/stats/stats.go | 2 ++ common/errors/errors.go | 1 + main/confloader/confloader.go | 2 -- main/confloader/errors.generated.go | 7 ------- proxy/vmess/outbound/outbound.go | 1 + proxy/vmess/vmess.go | 2 +- transport/internet/headers/tls/dtls.go | 2 +- transport/pipe/pipe.go | 1 + 12 files changed, 10 insertions(+), 22 deletions(-) delete mode 100644 app/proxyman/errors.generated.go delete mode 100644 main/confloader/errors.generated.go diff --git a/app/log/command/command.go b/app/log/command/command.go index 4c6d7236a..a85f854e4 100644 --- a/app/log/command/command.go +++ b/app/log/command/command.go @@ -16,6 +16,7 @@ type LoggerServer struct { V *core.Instance } +// RestartLogger implements LoggerService. func (s *LoggerServer) RestartLogger(ctx context.Context, request *RestartLoggerRequest) (*RestartLoggerResponse, error) { logger := s.V.GetFeature((*log.Instance)(nil)) if logger == nil { diff --git a/app/log/log.go b/app/log/log.go index 5471fb35f..684fa0bf1 100644 --- a/app/log/log.go +++ b/app/log/log.go @@ -138,10 +138,10 @@ func (g *Instance) Close() error { g.active = false - common.Close(g.accessLogger) + common.Ignore(common.Close(g.accessLogger), "Recycling it anyway") g.accessLogger = nil - common.Close(g.errorLogger) + common.Ignore(common.Close(g.errorLogger), "Recycling this too") g.errorLogger = nil return nil diff --git a/app/proxyman/errors.generated.go b/app/proxyman/errors.generated.go deleted file mode 100644 index b69ca4bc4..000000000 --- a/app/proxyman/errors.generated.go +++ /dev/null @@ -1,7 +0,0 @@ -package proxyman - -import "v2ray.com/core/common/errors" - -func newError(values ...interface{}) *errors.Error { - return errors.New(values...).Path("App", "Proxyman") -} diff --git a/app/proxyman/proxyman.go b/app/proxyman/proxyman.go index 361eb4c71..1f5e7ac27 100644 --- a/app/proxyman/proxyman.go +++ b/app/proxyman/proxyman.go @@ -1,8 +1,6 @@ // Package proxyman defines applications for managing inbound and outbound proxies. package proxyman -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg proxyman -path App,Proxyman - import ( "context" ) diff --git a/app/stats/stats.go b/app/stats/stats.go index 03ee2982c..595f97f6c 100644 --- a/app/stats/stats.go +++ b/app/stats/stats.go @@ -74,10 +74,12 @@ func (m *Manager) GetCounter(name string) core.StatCounter { return nil } +// Start implements common.Runnable. func (m *Manager) Start() error { return nil } +// Close implement common.Closable. func (m *Manager) Close() error { return nil } diff --git a/common/errors/errors.go b/common/errors/errors.go index daac515d2..b9b354157 100644 --- a/common/errors/errors.go +++ b/common/errors/errors.go @@ -63,6 +63,7 @@ func (v *Error) WithContext(ctx context.Context) *Error { return v } +// Context returns the context that associated with the Error. func (v *Error) Context() context.Context { if v.ctx != nil { return v.ctx diff --git a/main/confloader/confloader.go b/main/confloader/confloader.go index f9dd9223d..9edf6909e 100644 --- a/main/confloader/confloader.go +++ b/main/confloader/confloader.go @@ -5,8 +5,6 @@ import ( "os" ) -//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg confloader -path Main,ConfLoader - type configFileLoader func(string) (io.ReadCloser, error) var ( diff --git a/main/confloader/errors.generated.go b/main/confloader/errors.generated.go deleted file mode 100644 index 3dc7962c9..000000000 --- a/main/confloader/errors.generated.go +++ /dev/null @@ -1,7 +0,0 @@ -package confloader - -import "v2ray.com/core/common/errors" - -func newError(values ...interface{}) *errors.Error { - return errors.New(values...).Path("Main", "ConfLoader") -} diff --git a/proxy/vmess/outbound/outbound.go b/proxy/vmess/outbound/outbound.go index 1a6c4f21f..217d733aa 100644 --- a/proxy/vmess/outbound/outbound.go +++ b/proxy/vmess/outbound/outbound.go @@ -29,6 +29,7 @@ type Handler struct { v *core.Instance } +// New creates a new VMess outbound handler. func New(ctx context.Context, config *Config) (*Handler, error) { serverList := protocol.NewServerList() for _, rec := range config.Receiver { diff --git a/proxy/vmess/vmess.go b/proxy/vmess/vmess.go index 95166400c..6efd5719a 100644 --- a/proxy/vmess/vmess.go +++ b/proxy/vmess/vmess.go @@ -56,7 +56,7 @@ func NewTimedUserValidator(hasher protocol.IDHash) *TimedUserValidator { return nil }, } - tuv.task.Start() + common.Must(tuv.task.Start()) return tuv } diff --git a/transport/internet/headers/tls/dtls.go b/transport/internet/headers/tls/dtls.go index 01bd88d6b..06a61f69a 100644 --- a/transport/internet/headers/tls/dtls.go +++ b/transport/internet/headers/tls/dtls.go @@ -10,8 +10,8 @@ import ( // DTLS writes header as DTLS. See https://tools.ietf.org/html/rfc6347 type DTLS struct { epoch uint16 - sequence uint32 length uint16 + sequence uint32 } // Size implements PacketHeader. diff --git a/transport/pipe/pipe.go b/transport/pipe/pipe.go index c4391f902..aad00259f 100644 --- a/transport/pipe/pipe.go +++ b/transport/pipe/pipe.go @@ -7,6 +7,7 @@ import ( "v2ray.com/core/common/signal" ) +// Option for creating new Pipes. type Option func(*pipe) func WithoutSizeLimit() Option {