Preparing report...

Report for github.com/hedzr/go-socketlib

A    Great!    Found 32 issues across 49 files

Tweet

gofmt100%

Gofmt formats Go programs. We run gofmt -s on your code, where -s is for the "simplify" command

No problems detected. Good job!


go_vet100%

go vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.

No problems detected. Good job!


gocyclo95%

Gocyclo calculates cyclomatic complexities of functions in Go source code. The cyclomatic complexity of a function is calculated according to the following rules: 1 is the base complexity of a function +1 for each 'if', 'for', 'case', '&&' or '||' Go Report Card warns on functions with cyclomatic complexity > 15.

    • go-socketlib/tcp/tls/cmdr.go
    • Line 80: warning: cyclomatic complexity 24 of function (*CmdrTlsConfig).InitTlsConfigFromCommandline() is high (> 15) (gocyclo)
    • Line 147: warning: cyclomatic complexity 16 of function (*CmdrTlsConfig).InitTlsConfigFromConfigFile() is high (> 15) (gocyclo)

golint34%

Golint is a linter for Go source code.

    • go-socketlib/tcp/udp/new.with.go
    • Line 12: warning: exported type Opt should have comment or be unexported (golint)
    • Line 14: warning: exported function New should have comment or be unexported (golint)
    • Line 42: warning: exported function WithListenerNumber should have comment or be unexported (golint)
    • Line 48: warning: exported function WithUDPConn should have comment or be unexported (golint)
    • go-socketlib/tcp/server/cmdr.go
    • Line 14: warning: exported type CmdrOpt should have comment or be unexported (golint)
    • Line 25: warning: exported function WithCmdrUDPMode should have comment or be unexported (golint)
    • Line 89: warning: exported function WithCmdrPort should have comment or be unexported (golint)
    • Line 95: warning: exported function WithCmdrServerProtocolInterceptor should have comment or be unexported (golint)
    • Line 102: warning: exported function WithCmdrServerOptions should have comment or be unexported (golint)
    • Line 117: warning: exported function WithCmdrLogger should have comment or be unexported (golint)
    • Line 123: warning: exported function WithCmdrNil should have comment or be unexported (golint)
    • Line 127: warning: exported function AttachToCmdr should have comment or be unexported (golint)
    • go-socketlib/tcp/tls/tls_consts.go
    • Line 3: warning: exported type VersionTLS should have comment or be unexported (golint)
    • Line 6: warning: exported const VersionTLS10 should have comment (or a comment on this block) or be unexported (golint)
    • Line 11: warning: comment on exported const VersionSSL30 should be of the form "VersionSSL30 ..." (golint)
    • go-socketlib/tcp/internal/tcp.ref.go
    • Line 18: warning: comment on exported function Copy should be of the form "Copy ..." (golint)
    • Line 44: warning: exported function Copyd should have comment or be unexported (golint)
    • Line 71: warning: exported function OnRead should have comment or be unexported (golint)
    • go-socketlib/tcp/base/base.go
    • Line 8: warning: exported type Base should have comment or be unexported (golint)
    • Line 12: warning: exported function NewBase should have comment or be unexported (golint)
    • Line 16: warning: exported function NewBaseLogger should have comment or be unexported (golint)
    • go-socketlib/tcp/tcp.server.go
    • Line 13: warning: exported type ServerOpt should have comment or be unexported (golint)
    • Line 14: warning: exported type ClientOpt should have comment or be unexported (golint)
    • Line 16: warning: exported function StartServer should have comment or be unexported (golint)
    • Line 24: warning: exported function StopServer should have comment or be unexported (golint)
    • go-socketlib/tcp/protocol/protocol.go
    • Line 9: warning: exported type ClientInterceptor should have comment or be unexported (golint)
    • Line 22: warning: exported type Interceptor should have comment or be unexported (golint)
    • Line 30: warning: exported type ClientInterceptorHolder should have comment or be unexported (golint)
    • Line 34: warning: exported type InterceptorHolder should have comment or be unexported (golint)
    • go-socketlib/tcp/client/cmdr.go
    • Line 17: warning: exported const DefaultPort should have comment (or a comment on this block) or be unexported (golint)
    • Line 20: warning: exported type CmdrOpt should have comment or be unexported (golint)
    • Line 22: warning: exported function WithCmdrUDPMode should have comment or be unexported (golint)
    • Line 28: warning: exported function WithCmdrPort should have comment or be unexported (golint)
    • Line 34: warning: exported function WithCmdrPrefixPrefix should have comment or be unexported (golint)
    • Line 40: warning: exported function WithCmdrClientProtocolInterceptor should have comment or be unexported (golint)
    • Line 47: warning: exported function WithCmdrClientOptions should have comment or be unexported (golint)
    • Line 53: warning: exported function WithCmdrInteractiveCommand should have comment or be unexported (golint)
    • Line 59: warning: exported function WithCmdrCommandAction should have comment or be unexported (golint)
    • Line 65: warning: exported function WithCmdrMainLoop should have comment or be unexported (golint)
    • Line 71: warning: exported function WithCmdrNil should have comment or be unexported (golint)
    • Line 85: warning: exported function AttachToCmdr should have comment or be unexported (golint)
    • go-socketlib/tcp/tcp.server.impl.go
    • Line 19: warning: exported const DefaultBufferSize should have comment (or a comment on this block) or be unexported (golint)
    • Line 22: warning: exported type OnTcpServerCreateReadWriter should have comment or be unexported (golint)
    • Line 23: warning: exported type OnTcpServerConnectedWithClient should have comment or be unexported (golint)
    • Line 24: warning: exported type OnTcpServerDisconnectedWithClient should have comment or be unexported (golint)
    • Line 25: warning: exported type OnTcpServerProcessFunc should have comment or be unexported (golint)
    • Line 26: warning: exported type OnTcpServerListening should have comment or be unexported (golint)
    • Line 40: warning: exported type Server should have comment or be unexported (golint)
    • Line 93: warning: exported method Server.Start should have comment or be unexported (golint)
    • Line 139: warning: exported method Server.Stop should have comment or be unexported (golint)
    • Line 143: warning: exported method Server.Close should have comment or be unexported (golint)
    • go-socketlib/tcp/client/client.go
    • Line 26: warning: exported type CommandAction should have comment or be unexported (golint)
    • Line 27: warning: exported type MainLoop should have comment or be unexported (golint)
    • Line 28: warning: exported type MainLoopHolder should have comment or be unexported (golint)
    • Line 32: warning: exported function DefaultCmdrCommandAction should have comment or be unexported (golint)
    • Line 48: warning: exported function DefaultCommandAction should have comment or be unexported (golint)
    • go-socketlib/tcp/base/writer.go
    • Line 5: warning: exported type CachedTCPWriter should have comment or be unexported (golint)
    • Line 12: warning: exported type CachedUDPWriter should have comment or be unexported (golint)
    • go-socketlib/tcp/client/client.withopts.go
    • Line 11: warning: exported function New should have comment or be unexported (golint)
    • Line 19: warning: exported type Opt should have comment or be unexported (golint)
    • Line 21: warning: exported function WithClientUDPMode should have comment or be unexported (golint)
    • Line 31: warning: exported function WithClientMainLoop should have comment or be unexported (golint)
    • Line 37: warning: exported function WithClientPrefixPrefix should have comment or be unexported (golint)
    • Line 43: warning: exported function WithClientProtocolInterceptor should have comment or be unexported (golint)
    • go-socketlib/tcp/tcp.server.withopts.go
    • Line 13: warning: exported function WithServerOnProcessFunc should have comment or be unexported (golint)
    • Line 19: warning: exported function WithServerBufferSize should have comment or be unexported (golint)
    • Line 28: warning: exported function WithServerReadWriter should have comment or be unexported (golint)
    • Line 34: warning: exported function WithServerDisconnectedWithClient should have comment or be unexported (golint)
    • Line 40: warning: exported function WithServerConnectedWithClient should have comment or be unexported (golint)
    • Line 46: warning: exported function WithServerListening should have comment or be unexported (golint)
    • Line 52: warning: exported function WithTlsConfig should have comment or be unexported (golint)
    • Line 64: warning: exported function WithLogger should have comment or be unexported (golint)
    • go-socketlib/tcp/udp/obj.go
    • Line 18: warning: exported type Obj should have comment or be unexported (golint)
    • Line 37: warning: exported method Obj.IsConnected should have comment or be unexported (golint)
    • Line 41: warning: exported method Obj.AsBaseConn should have comment or be unexported (golint)
    • Line 54: warning: exported method Obj.Close should have comment or be unexported (golint)
    • Line 193: warning: exported method Obj.ClientServe should have comment or be unexported (golint)
    • Line 201: warning: should not use basic type string as key in context.WithValue (golint)
    • Line 213: warning: exported method Obj.Serve should have comment or be unexported (golint)
    • Line 221: warning: should not use basic type string as key in context.WithValue (golint)
    • Line 233: warning: exported method Obj.RemoteAddr should have comment or be unexported (golint)
    • Line 242: warning: exported method Obj.RawWrite should have comment or be unexported (golint)
    • Line 540: warning: exported const DefaultPacketSize should have comment (or a comment on this block) or be unexported (golint)
    • go-socketlib/tcp/server/server.obj.go
    • Line 16: warning: exported type Obj should have comment or be unexported (golint)
    • Line 36: warning: exported type NewConnectionFunc should have comment or be unexported (golint)
    • Line 55: warning: exported method Obj.BaseUri should have comment or be unexported (golint)
    • Line 59: warning: exported method Obj.Config should have comment or be unexported (golint)
    • Line 63: warning: exported method Obj.SetLogger should have comment or be unexported (golint)
    • Line 67: warning: exported method Obj.WithLogger should have comment or be unexported (golint)
    • Line 77: warning: exported method Obj.ProtocolInterceptor should have comment or be unexported (golint)
    • Line 81: warning: exported method Obj.SetProtocolInterceptor should have comment or be unexported (golint)
    • Line 85: warning: exported method Obj.WithProtocolInterceptor should have comment or be unexported (golint)
    • Line 90: warning: exported method Obj.ListenTo should have comment or be unexported (golint)
    • Line 94: warning: exported method Obj.Close should have comment or be unexported (golint)
    • Line 164: warning: exported method Obj.Serve should have comment or be unexported (golint)
    • Line 234: warning: exported method Obj.SetNewConnectionFunc should have comment or be unexported (golint)
    • Line 239: warning: exported method Obj.RequestShutdown should have comment or be unexported (golint)
    • go-socketlib/tcp/base/config.go
    • Line 17: warning: exported type Config should have comment or be unexported (golint)
    • Line 35: warning: exported function NewConfigFromCmdrCommand should have comment or be unexported (golint)
    • Line 47: warning: exported function NewConfigWithParams should have comment or be unexported (golint)
    • Line 75: warning: exported method Config.UpdatePrefixInConfigFile should have comment or be unexported (golint)
    • Line 81: warning: exported method Config.BuildLogger should have comment or be unexported (golint)
    • Line 85: warning: exported method Config.BuildPidFileStruct should have comment or be unexported (golint)
    • Line 89: warning: exported method Config.BuildServerAddr should have comment or be unexported (golint)
    • Line 119: warning: exported method Config.BuildAddr should have comment or be unexported (golint)
    • Line 147: warning: exported method Config.BuildUriAddr should have comment or be unexported (golint)
    • Line 169: warning: exported method Config.PressEnterToExit should have comment or be unexported (golint)
    • Line 179: warning: exported const DefaultPidPathTemplate should have comment or be unexported (golint)
    • Line 180: warning: exported const DefaultPidDirTemplate should have comment or be unexported (golint)
    • go-socketlib/tcp/tls/cmdr.go
    • Line 21: warning: exported function NewTlsConfig should have comment or be unexported (golint)
    • Line 31: warning: exported function NewCmdrTlsConfig should have comment or be unexported (golint)
    • Line 44: warning: exported method CmdrTlsConfig.WithLogger should have comment or be unexported (golint)
    • Line 68: warning: exported method CmdrTlsConfig.IsServerCertValid should have comment or be unexported (golint)
    • Line 72: warning: exported method CmdrTlsConfig.IsCertValid should have comment or be unexported (golint)
    • Line 76: warning: exported method CmdrTlsConfig.IsClientAuthValid should have comment or be unexported (golint)
    • Line 80: warning: exported method CmdrTlsConfig.InitTlsConfigFromCommandline should have comment or be unexported (golint)
    • Line 147: warning: exported method CmdrTlsConfig.InitTlsConfigFromConfigFile should have comment or be unexported (golint)
    • Line 216: warning: exported method CmdrTlsConfig.ToTlsConfig should have comment or be unexported (golint)
    • Line 271: warning: exported method CmdrTlsConfig.NewTlsListener should have comment or be unexported (golint)
    • go-socketlib/tcp/tcp.client.impl.go
    • Line 22: warning: exported type Client should have comment or be unexported (golint)
    • Line 43: warning: exported type OnTcpConnectedFunc should have comment or be unexported (golint)
    • Line 44: warning: exported type OnTcpProcessFunc should have comment or be unexported (golint)
    • Line 45: warning: exported type OnTcpDisconnectedFunc should have comment or be unexported (golint)
    • Line 47: warning: exported function NewClient should have comment or be unexported (golint)
    • Line 57: warning: exported function WithClientTlsConfig should have comment or be unexported (golint)
    • Line 63: warning: exported function WithClientReadBufferSize should have comment or be unexported (golint)
    • Line 69: warning: exported function WithClientOnProcessFunc should have comment or be unexported (golint)
    • Line 75: warning: exported function WithClientOnConnectedFunc should have comment or be unexported (golint)
    • Line 81: warning: exported function WithClientOnDisconnectedFunc should have comment or be unexported (golint)
    • Line 93: warning: exported function WithClientLogger should have comment or be unexported (golint)
    • Line 174: warning: exported method Client.IsClosed should have comment or be unexported (golint)
    • Line 179: warning: exported method Client.Close should have comment or be unexported (golint)
    • Line 229: warning: exported method Client.Send should have comment or be unexported (golint)
    • Line 236: warning: don't use underscores in Go names; method write_ should be write (golint)
    • go-socketlib/tcp/server/new.withopts.go
    • Line 11: warning: exported function New should have comment or be unexported (golint)
    • Line 16: warning: exported function WithServerNewConnectionFunc should have comment or be unexported (golint)
    • Line 22: warning: exported function WithServerProtocolInterceptor should have comment or be unexported (golint)
    • Line 28: warning: exported function WithServerPrefixInConfigFile should have comment or be unexported (golint)
    • Line 34: warning: exported function WithServerUDPMode should have comment or be unexported (golint)
    • Line 40: warning: exported function WithServerLogger should have comment or be unexported (golint)
    • Line 74: warning: exported type Opt should have comment or be unexported (golint)
    • Line 75: warning: exported type ServeFunc should have comment or be unexported (golint)
    • Line 77: warning: exported var ErrServerClosed should have comment or be unexported (golint)
    • Line 80: warning: exported const DefaultPort should have comment (or a comment on this block) or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign0%

IneffAssign detects ineffectual assignments in Go code.

An error occurred while running this test (signal: killed)


misspell100%

Misspell Finds commonly misspelled English words

No problems detected. Good job!