Preparing report...

Report for github.com/zouyapeng/rpcx

A+    Excellent!    Found 54 issues across 97 files

Tweet

gofmt97%

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


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!


gocyclo81%

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.

    • rpcx/client/client.go
    • Line 573: warning: cyclomatic complexity 31 of function (*Client).input() is high (> 15) (gocyclo)
    • Line 467: warning: cyclomatic complexity 19 of function (*Client).send() is high (> 15) (gocyclo)
    • rpcx/client/xclient.go
    • Line 411: warning: cyclomatic complexity 41 of function (*xClient).Call() is high (> 15) (gocyclo)
    • Line 567: warning: cyclomatic complexity 24 of function (*xClient).SendRaw() is high (> 15) (gocyclo)
    • Line 746: warning: cyclomatic complexity 20 of function (*xClient).Fork() is high (> 15) (gocyclo)
    • Line 832: warning: cyclomatic complexity 16 of function (*xClient).SendFile() is high (> 15) (gocyclo)
    • Line 675: warning: cyclomatic complexity 16 of function (*xClient).Broadcast() is high (> 15) (gocyclo)

golint50%

Golint is a linter for Go source code.

    • rpcx/client/redis_discovery.go
    • Line 135: warning: exported method RedisDiscovery.RemoveWatcher should have comment or be unexported (golint)
    • Line 252: warning: exported method RedisDiscovery.Close should have comment or be unexported (golint)
    • rpcx/codec/codec.go
    • Line 108: warning: exported type ThriftCodec should have comment or be unexported (golint)
    • Line 110: warning: exported method ThriftCodec.Encode should have comment or be unexported (golint)
    • Line 121: warning: exported method ThriftCodec.Decode should have comment or be unexported (golint)
    • rpcx/util/buffer_pool.go
    • Line 25: warning: exported type LimitedPool should have comment or be unexported (golint)
    • Line 31: warning: exported function NewLimitedPool should have comment or be unexported (golint)
    • Line 82: warning: exported method LimitedPool.Get should have comment or be unexported (golint)
    • Line 93: warning: exported method LimitedPool.Put should have comment or be unexported (golint)
    • rpcx/util/converter.go
    • Line 7: warning: exported function SliceByteToString should have comment or be unexported (golint)
    • Line 11: warning: exported function StringToSliceByte should have comment or be unexported (golint)
    • Line 17: warning: exported function CopyMeta should have comment or be unexported (golint)
    • rpcx/serverplugin/mdns.go
    • Line 185: warning: exported method MDNSRegisterPlugin.RegisterFunction should have comment or be unexported (golint)
    • Line 189: warning: exported method MDNSRegisterPlugin.Unregister should have comment or be unexported (golint)
    • rpcx/server/file_transfer.go
    • Line 48: warning: exported type FileTransferService should have comment or be unexported (golint)
    • Line 80: warning: exported method FileTransferService.TransferFile should have comment or be unexported (golint)
    • Line 96: warning: exported method FileTransferService.DownloadFile should have comment or be unexported (golint)
    • Line 112: warning: exported method FileTransfer.Start should have comment or be unexported (golint)
    • Line 199: warning: exported method FileTransfer.Stop should have comment or be unexported (golint)
    • rpcx/client/client.go
    • Line 25: warning: exported const XVersion should have comment (or a comment on this block) or be unexported (golint)
    • rpcx/serverplugin/consul.go
    • Line 224: warning: exported method ConsulRegisterPlugin.RegisterFunction should have comment or be unexported (golint)
    • Line 228: warning: exported method ConsulRegisterPlugin.Unregister should have comment or be unexported (golint)
    • rpcx/serverplugin/opencensus.go
    • Line 13: warning: exported type OpenCensusPlugin should have comment or be unexported (golint)
    • Line 15: warning: exported method OpenCensusPlugin.Register should have comment or be unexported (golint)
    • Line 24: warning: exported method OpenCensusPlugin.RegisterFunction should have comment or be unexported (golint)
    • Line 32: warning: exported method OpenCensusPlugin.PostConnAccept should have comment or be unexported (golint)
    • Line 40: warning: exported method OpenCensusPlugin.PreHandleRequest should have comment or be unexported (golint)
    • Line 56: warning: exported method OpenCensusPlugin.PostWriteResponse should have comment or be unexported (golint)
    • rpcx/serverplugin/opentracing.go
    • Line 15: warning: exported type OpenTracingPlugin should have comment or be unexported (golint)
    • Line 17: warning: exported method OpenTracingPlugin.Register should have comment or be unexported (golint)
    • Line 27: warning: exported method OpenTracingPlugin.RegisterFunction should have comment or be unexported (golint)
    • Line 36: warning: exported method OpenTracingPlugin.PostConnAccept should have comment or be unexported (golint)
    • Line 45: warning: exported method OpenTracingPlugin.PreHandleRequest should have comment or be unexported (golint)
    • Line 63: warning: exported method OpenTracingPlugin.PostWriteResponse should have comment or be unexported (golint)
    • rpcx/server/plugin.go
    • Line 84: warning: exported type PreCallPlugin should have comment or be unexported (golint)
    • Line 88: warning: exported type PostCallPlugin should have comment or be unexported (golint)
    • rpcx/client/hash_utils.go
    • Line 35: warning: comment on exported type ConsistentAddrStrFunction should be of the form "ConsistentAddrStrFunction ..." (with optional leading article) (golint)
    • rpcx/protocol/compressor.go
    • Line 17: warning: exported method GzipCompressor.Zip should have comment or be unexported (golint)
    • Line 21: warning: exported method GzipCompressor.Unzip should have comment or be unexported (golint)
    • Line 25: warning: exported type RawDataCompressor should have comment or be unexported (golint)
    • Line 28: warning: exported method RawDataCompressor.Zip should have comment or be unexported (golint)
    • Line 32: warning: exported method RawDataCompressor.Unzip should have comment or be unexported (golint)
    • rpcx/serverplugin/etcdv3.go
    • Line 212: warning: exported method EtcdV3RegisterPlugin.RegisterFunction should have comment or be unexported (golint)
    • Line 216: warning: exported method EtcdV3RegisterPlugin.Unregister should have comment or be unexported (golint)
    • rpcx/client/opencensus.go
    • Line 10: warning: exported type OpenCensusPlugin should have comment or be unexported (golint)
    • Line 12: warning: exported method OpenCensusPlugin.PreCall should have comment or be unexported (golint)
    • Line 36: warning: exported method OpenCensusPlugin.PostCall should have comment or be unexported (golint)
    • rpcx/client/opentracing.go
    • Line 11: warning: exported type OpenTracingPlugin should have comment or be unexported (golint)
    • Line 13: warning: exported method OpenTracingPlugin.PreCall should have comment or be unexported (golint)
    • Line 39: warning: exported method OpenTracingPlugin.PostCall should have comment or be unexported (golint)
    • rpcx/client/peer2peer_discovery.go
    • Line 35: warning: exported method Peer2PeerDiscovery.RemoveWatcher should have comment or be unexported (golint)
    • Line 37: warning: exported method Peer2PeerDiscovery.Close should have comment or be unexported (golint)
    • rpcx/client/xclient.go
    • Line 24: warning: exported const FileTransferBufferSize should have comment (or a comment on this block) or be unexported (golint)
    • Line 885: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 896: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • rpcx/serverplugin/etcd.go
    • Line 212: warning: exported method EtcdRegisterPlugin.RegisterFunction should have comment or be unexported (golint)
    • Line 216: warning: exported method EtcdRegisterPlugin.Unregister should have comment or be unexported (golint)
    • rpcx/client/circuit_breaker.go
    • Line 10: warning: exported var ErrBreakerOpen should have comment or be unexported (golint)
    • Line 84: warning: exported method ConsecCircuitBreaker.Success should have comment or be unexported (golint)
    • Line 87: warning: exported method ConsecCircuitBreaker.Fail should have comment or be unexported (golint)
    • Line 91: warning: exported method ConsecCircuitBreaker.Ready should have comment or be unexported (golint)
    • rpcx/client/etcd_discovery.go
    • Line 132: warning: exported method EtcdDiscovery.RemoveWatcher should have comment or be unexported (golint)
    • Line 245: warning: exported method EtcdDiscovery.Close should have comment or be unexported (golint)
    • rpcx/client/nacos_discovery.go
    • Line 64: warning: exported function NewNacosDiscoveryWithClient should have comment or be unexported (golint)
    • Line 137: warning: exported method NacosDiscovery.RemoveWatcher should have comment or be unexported (golint)
    • Line 220: warning: exported method NacosDiscovery.Close should have comment or be unexported (golint)
    • rpcx/serverplugin/nacos.go
    • Line 121: warning: exported method NacosRegisterPlugin.RegisterFunction should have comment or be unexported (golint)
    • Line 125: warning: exported method NacosRegisterPlugin.Unregister should have comment or be unexported (golint)
    • rpcx/serverplugin/zookeeper.go
    • Line 225: warning: exported method ZooKeeperRegisterPlugin.RegisterFunction should have comment or be unexported (golint)
    • Line 229: warning: exported method ZooKeeperRegisterPlugin.Unregister should have comment or be unexported (golint)
    • rpcx/client/oneclient.go
    • Line 80: warning: exported method OneClient.GetPlugins should have comment or be unexported (golint)
    • Line 192: warning: exported method OneClient.SendRaw should have comment or be unexported (golint)
    • Line 266: warning: exported method OneClient.SendFile should have comment or be unexported (golint)
    • Line 288: warning: exported method OneClient.DownloadFile should have comment or be unexported (golint)
    • rpcx/client/zookeeper_discovery.go
    • Line 141: warning: exported method ZookeeperDiscovery.RemoveWatcher should have comment or be unexported (golint)
    • Line 202: warning: exported method ZookeeperDiscovery.Close should have comment or be unexported (golint)
    • rpcx/client/inprocess_discovery.go
    • Line 33: warning: exported method InprocessDiscovery.RemoveWatcher should have comment or be unexported (golint)
    • Line 36: warning: exported method InprocessDiscovery.Close should have comment or be unexported (golint)
    • rpcx/share/context.go
    • Line 21: warning: exported function NewContext should have comment or be unexported (golint)
    • Line 28: warning: exported method Context.Value should have comment or be unexported (golint)
    • Line 39: warning: exported method Context.SetValue should have comment or be unexported (golint)
    • Line 50: warning: exported function WithValue should have comment or be unexported (golint)
    • Line 63: warning: exported function WithLocalValue should have comment or be unexported (golint)
    • rpcx/util/net.go
    • Line 49: warning: exported function ConvertMeta2Map should have comment or be unexported (golint)
    • Line 67: warning: exported function ConvertMap2String should have comment or be unexported (golint)
    • rpcx/client/etcdv3_discovery.go
    • Line 135: warning: exported method EtcdV3Discovery.RemoveWatcher should have comment or be unexported (golint)
    • Line 253: warning: exported method EtcdV3Discovery.Close should have comment or be unexported (golint)
    • rpcx/protocol/message.go
    • Line 33: warning: exported function MagicNumber should have comment or be unexported (golint)
    • Line 43: warning: exported var ErrUnsupportedCompressor should have comment or be unexported (golint)
    • Line 93: warning: comment on exported const Thrift should be of the form "Thrift ..." (golint)
    • rpcx/client/connection.go
    • Line 16: warning: exported type ConnFactoryFn should have comment or be unexported (golint)
    • Line 18: warning: exported var ConnFactories should have comment or be unexported (golint)
    • rpcx/client/consul_discovery.go
    • Line 124: warning: exported method ConsulDiscovery.RemoveWatcher should have comment or be unexported (golint)
    • Line 221: warning: exported method ConsulDiscovery.Close should have comment or be unexported (golint)
    • rpcx/log/logger.go
    • Line 14: warning: exported type Logger should have comment or be unexported (golint)
    • Line 34: warning: exported type Handler should have comment or be unexported (golint)
    • Line 38: warning: exported function SetLogger should have comment or be unexported (golint)
    • Line 42: warning: exported function SetDummyLogger should have comment or be unexported (golint)
    • Line 46: warning: exported function Debug should have comment or be unexported (golint)
    • Line 49: warning: exported function Debugf should have comment or be unexported (golint)
    • Line 53: warning: exported function Info should have comment or be unexported (golint)
    • Line 56: warning: exported function Infof should have comment or be unexported (golint)
    • Line 60: warning: exported function Warn should have comment or be unexported (golint)
    • Line 63: warning: exported function Warnf should have comment or be unexported (golint)
    • Line 67: warning: exported function Error should have comment or be unexported (golint)
    • Line 70: warning: exported function Errorf should have comment or be unexported (golint)
    • Line 74: warning: exported function Fatal should have comment or be unexported (golint)
    • Line 77: warning: exported function Fatalf should have comment or be unexported (golint)
    • Line 81: warning: exported function Panic should have comment or be unexported (golint)
    • Line 84: warning: exported function Panicf should have comment or be unexported (golint)
    • Line 88: warning: exported function Handle should have comment or be unexported (golint)
    • rpcx/reflection/server_reflection.go
    • Line 62: warning: exported type Reflection should have comment or be unexported (golint)
    • Line 66: warning: exported function New should have comment or be unexported (golint)
    • Line 71: warning: exported method Reflection.Register should have comment or be unexported (golint)
    • Line 149: warning: exported method Reflection.Unregister should have comment or be unexported (golint)
    • Line 154: warning: exported method Reflection.GetService should have comment or be unexported (golint)
    • Line 164: warning: exported method Reflection.GetServices should have comment or be unexported (golint)
    • rpcx/server/jsonrpc2_wire.go
    • Line 91: warning: exported method JSONRPCError.JSONRPCError should have comment or be unexported (golint)
    • Line 98: warning: exported method VersionTag.MarshalJSON should have comment or be unexported (golint)
    • Line 102: warning: exported method VersionTag.UnmarshalJSON should have comment or be unexported (golint)
    • Line 126: warning: exported method ID.MarshalJSON should have comment or be unexported (golint)
    • Line 133: warning: exported method ID.UnmarshalJSON should have comment or be unexported (golint)
    • rpcx/client/mdns_discovery.go
    • Line 88: warning: exported method MDNSDiscovery.RemoveWatcher should have comment or be unexported (golint)
    • Line 186: warning: exported method MDNSDiscovery.Close should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign98%

IneffAssign detects ineffectual assignments in Go code.

    • rpcx/reflection/server_reflection_test.go
    • Line 9: warning: no required module provides package github.com/zouyapeng/rpcx/_testutils; to add it: (ineffassign)
    • Line 9: warning: could not import github.com/zouyapeng/rpcx/_testutils (invalid package name: "") (ineffassign)

misspell98%

Misspell Finds commonly misspelled English words

    • rpcx/tool/xgen/xgen.go
    • Line 160: warning: "registery" is a misspelling of "registry" (misspell)
    • Line 170: warning: "registery" is a misspelling of "registry" (misspell)
    • Line 180: warning: "registery" is a misspelling of "registry" (misspell)