Preparing report...

Report for github.com/hetianyi/godfs

A    Great!    Found 28 issues across 44 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!


gocyclo77%

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.

    • godfs/api/client_api.go
    • Line 217: warning: cyclomatic complexity 20 of function (*clientAPIImpl).DownloadFrom() is high (> 15) (gocyclo)
    • Line 323: warning: cyclomatic complexity 16 of function (*clientAPIImpl).Query() is high (> 15) (gocyclo)
    • godfs/command/cmd_handler.go
    • Line 157: warning: cyclomatic complexity 23 of function handleDownloadFile() is high (> 15) (gocyclo)
    • Line 75: warning: cyclomatic complexity 17 of function handleUploadFile() is high (> 15) (gocyclo)
    • godfs/svc/storage_http_server.go
    • Line 257: warning: cyclomatic complexity 25 of function httpUpload1() is high (> 15) (gocyclo)
    • Line 465: warning: cyclomatic complexity 22 of function httpDownload() is high (> 15) (gocyclo)
    • Line 82: warning: cyclomatic complexity 18 of function httpUpload() is high (> 15) (gocyclo)
    • godfs/util/config_validator.go
    • Line 22: warning: cyclomatic complexity 44 of function ValidateStorageConfig() is high (> 15) (gocyclo)
    • Line 358: warning: cyclomatic complexity 41 of function ValidateTrackerConfig() is high (> 15) (gocyclo)
    • Line 203: warning: cyclomatic complexity 38 of function ValidateAgentConfig() is high (> 15) (gocyclo)

golint43%

Golint is a linter for Go source code.

    • godfs/util/aescbc_encrypt.go
    • Line 9: warning: exported function PKCS7Padding should have comment or be unexported (golint)
    • Line 15: warning: exported function PKCS7UnPadding should have comment or be unexported (golint)
    • Line 21: warning: exported function AesEncrypt should have comment or be unexported (golint)
    • Line 34: warning: exported function AesDecrypt should have comment or be unexported (golint)
    • godfs/common/common.go
    • Line 10: warning: exported const VERSION should have comment (or a comment on this block) or be unexported (golint)
    • Line 11: warning: comment on exported const BOOT_CLIENT should be of the form "BOOT_CLIENT ..." (golint)
    • Line 16: warning: comment on exported const GROUP_PATTERN should be of the form "GROUP_PATTERN ..." (golint)
    • Line 23: warning: comment on exported const DEFAULT_STORAGE_TCP_PORT should be of the form "DEFAULT_STORAGE_TCP_PORT ..." (golint)
    • Line 32: warning: comment on exported const OPERATION_RESPONSE should be of the form "OPERATION_RESPONSE ..." (golint)
    • Line 41: warning: comment on exported const SUCCESS should be of the form "SUCCESS ..." (golint)
    • Line 47: warning: comment on exported const CMD_SHOW_HELP should be of the form "CMD_SHOW_HELP ..." (golint)
    • Line 60: warning: comment on exported const ROLE_TRACKER should be of the form "ROLE_TRACKER ..." (golint)
    • Line 66: warning: comment on exported const REGISTER_HOLD should be of the form "REGISTER_HOLD ..." (golint)
    • Line 69: warning: comment on exported const REGISTER_INTERVAL should be of the form "REGISTER_INTERVAL ..." (golint)
    • Line 81: warning: error var NotFoundErr should have name of the form ErrFoo (golint)
    • Line 81: warning: exported var NotFoundErr should have comment or be unexported (golint)
    • Line 82: warning: error var ServerErr should have name of the form ErrFoo (golint)
    • Line 94: warning: exported function SetConfigMap should have comment or be unexported (golint)
    • Line 98: warning: exported function GetConfigMap should have comment or be unexported (golint)
    • Line 102: warning: exported function AddSecret should have comment or be unexported (golint)
    • Line 111: warning: exported function GetSecret should have comment or be unexported (golint)
    • godfs/common/mime_type.go
    • Line 115: warning: comment on exported function GetMimeType should be of the form "GetMimeType ..." (golint)
    • Line 124: warning: exported function AddWebMimeType should have comment or be unexported (golint)
    • godfs/common/type_def.go
    • Line 13: warning: exported type Command should have comment or be unexported (golint)
    • Line 14: warning: exported type Operation should have comment or be unexported (golint)
    • Line 15: warning: exported type OperationResult should have comment or be unexported (golint)
    • Line 16: warning: exported type BootMode should have comment or be unexported (golint)
    • Line 17: warning: exported type Role should have comment or be unexported (golint)
    • Line 18: warning: exported type RegisterState should have comment or be unexported (golint)
    • Line 20: warning: exported type StorageConfig should have comment or be unexported (golint)
    • Line 47: warning: exported type AgentConfig should have comment or be unexported (golint)
    • Line 65: warning: exported type TrackerConfig should have comment or be unexported (golint)
    • Line 86: warning: exported type ClientConfig should have comment or be unexported (golint)
    • Line 97: warning: exported type Server should have comment or be unexported (golint)
    • Line 106: warning: exported type StorageServer should have comment or be unexported (golint)
    • Line 111: warning: exported method Server.ConnectionString should have comment or be unexported (golint)
    • Line 125: warning: exported method StorageServer.ToServer should have comment or be unexported (golint)
    • Line 133: warning: exported type Header should have comment or be unexported (golint)
    • Line 140: warning: exported type UploadResult should have comment or be unexported (golint)
    • Line 146: warning: exported type FileInfo should have comment or be unexported (golint)
    • Line 155: warning: exported type Instance should have comment or be unexported (golint)
    • Line 163: warning: exported type InstanceMap should have comment or be unexported (golint)
    • Line 167: warning: exported type BingLog should have comment or be unexported (golint)
    • Line 173: warning: exported type BingLogDTO should have comment or be unexported (golint)
    • Line 198: warning: exported type ConfigMap should have comment or be unexported (golint)
    • Line 204: warning: exported function NewConfigMap should have comment or be unexported (golint)
    • Line 229: warning: exported method ConfigMap.BatchUpdate should have comment or be unexported (golint)
    • Line 242: warning: exported method ConfigMap.PutConfig should have comment or be unexported (golint)
    • Line 258: warning: exported method ConfigMap.GetConfig should have comment or be unexported (golint)
    • Line 267: warning: exported method ConfigMap.PutFile should have comment or be unexported (golint)
    • Line 287: warning: exported method ConfigMap.GetFile should have comment or be unexported (golint)
    • Line 296: warning: exported method ConfigMap.PutFailedBinlogPos should have comment or be unexported (golint)
    • Line 314: warning: exported method ConfigMap.IteratorFailedBinlog should have comment or be unexported (golint)
    • godfs/binlog/binlog.go
    • Line 21: warning: exported const LOCAL_BINLOG_MANAGER should have comment (or a comment on this block) or be unexported (golint)
    • Line 30: warning: exported type XBinlogManagerType should have comment or be unexported (golint)
    • Line 373: warning: exported function Copy8 should have comment or be unexported (golint)
    • godfs/api/instance_synchronizer.go
    • Line 75: warning: exported function FilterInstances should have comment or be unexported (golint)
    • Line 88: warning: exported function FilterInstanceByInstanceId should have comment or be unexported (golint)
    • Line 100: warning: comment on exported function FilterUploadableInstances should be of the form "FilterUploadableInstances ..." (golint)
    • godfs/util/storage.go
    • Line 28: warning: comment on exported function CreateMD5FileID should be of the form "CreateMD5FileID ..." (golint)
    • Line 45: warning: exported function ExistsFile should have comment or be unexported (golint)
    • godfs/svc/storage_tcp_handler.go
    • Line 25: warning: exported function StartStorageTcpServer should have comment or be unexported (golint)
    • Line 94: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • godfs/binlog/binlog_map.go
    • Line 13: warning: exported type XBinlogMapManager should have comment or be unexported (golint)
    • Line 90: warning: exported method XBinlogMapManager.SetRecords should have comment or be unexported (golint)
    • godfs/util/env_vars.go
    • Line 9: warning: exported function GetEnv should have comment or be unexported (golint)
    • Line 13: warning: comment on exported function ExchangeEnvValue should be of the form "ExchangeEnvValue ..." (golint)
    • godfs/util/http.go
    • Line 7: warning: exported function HttpFileNotFoundError should have comment or be unexported (golint)
    • Line 11: warning: exported function HttpInternalServerError should have comment or be unexported (golint)
    • Line 15: warning: exported function HttpForbiddenError should have comment or be unexported (golint)
    • godfs/svc/tracker_tcp_handler.go
    • Line 18: warning: exported function StartTrackerTcpServer should have comment or be unexported (golint)
    • Line 98: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • godfs/reg/registry.go
    • Line 1: warning: package comment should be of the form "Package reg ..." (golint)
    • Line 23: warning: exported var ExpirationTime should have comment or be unexported (golint)
    • godfs/api/client_api.go
    • Line 21: warning: comment on exported const DefaultMaxConnectionsPerServer should be of the form "DefaultMaxConnectionsPerServer ..." (golint)
    • Line 25: warning: error var NoStorageServerErr should have name of the form ErrFoo (golint)
    • Line 25: warning: exported var NoStorageServerErr should have comment or be unexported (golint)
    • godfs/util/config.go
    • Line 41: warning: exported function PrepareDirs should have comment or be unexported (golint)
    • Line 93: warning: comment on exported function DefaultDataDir should be of the form "DefaultDataDir ..." (golint)
    • Line 116: warning: exported function DefaultAdvertiseAddress should have comment or be unexported (golint)
    • Line 139: warning: exported function ParseServer should have comment or be unexported (golint)
    • Line 149: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • godfs/util/digest.go
    • Line 17: warning: exported function CreateCrc32Hash should have comment or be unexported (golint)
    • Line 22: warning: exported function GetCrc32HashString should have comment or be unexported (golint)
    • Line 29: warning: exported function CreateMd5Hash should have comment or be unexported (golint)
    • Line 33: warning: exported function GetMd5HashString should have comment or be unexported (golint)
    • godfs/util/config_validator.go
    • Line 524: warning: comment on exported function ValidateClientConfig should be of the form "ValidateClientConfig ..." (golint)
    • Line 568: warning: exported function InitialConfigMap should have comment or be unexported (golint)
    • Line 577: warning: exported function ConvertLogLevel should have comment or be unexported (golint)
    • Line 597: warning: exported function ConvertRollInterval should have comment or be unexported (golint)
    • Line 613: warning: exported function ConvertLogFileSize should have comment or be unexported (golint)
    • Line 641: warning: should omit 2nd value from range; this loop is equivalent to `for k := range ...` (golint)
    • Line 647: warning: exported function GetSecrets should have comment or be unexported (golint)
    • Line 716: warning: exported function CollectMapKeys should have comment or be unexported (golint)
    • Line 722: warning: should omit 2nd value from range; this loop is equivalent to `for i := range ...` (golint)
    • godfs/svc/storage_http_server.go
    • Line 29: warning: exported const FORM_TEXT should have comment (or a comment on this block) or be unexported (golint)
    • Line 37: warning: exported var RegexContentTypePattern should have comment or be unexported (golint)
    • Line 40: warning: exported type FormEntry should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign95%

IneffAssign detects ineffectual assignments in Go code.


misspell97%

Misspell Finds commonly misspelled English words