Preparing report...

Report for github.com/appscode/g2

A+    Excellent!    Found 35 issues across 55 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!


golint38%

Golint is a linter for Go source code.

    • g2/worker/worker.go
    • Line 1: warning: package comment should be of the form "Package worker ..." (golint)
    • Line 15: warning: exported const Unlimited should have comment (or a comment on this block) or be unexported (golint)
    • Line 42: warning: comment on exported function New should be of the form "New ..." (golint)
    • Line 68: warning: comment on exported method Worker.AddServer should be of the form "AddServer ..." (golint)
    • Line 88: warning: comment on exported method Worker.AddFunc should be of the form "AddFunc ..." (golint)
    • Line 126: warning: comment on exported method Worker.RemoveFunc should be of the form "RemoveFunc ..." (golint)
    • Line 179: warning: comment on exported method Worker.Ready should be of the form "Ready ..." (golint)
    • Line 204: warning: comment on exported method Worker.Work should be of the form "Work ..." (golint)
    • Line 247: warning: exported method Worker.Reconnect should have comment or be unexported (golint)
    • Line 260: warning: comment on exported method Worker.Echo should be of the form "Echo ..." (golint)
    • Line 268: warning: comment on exported method Worker.Reset should be of the form "Reset ..." (golint)
    • Line 277: warning: comment on exported method Worker.SetId should be of the form "SetId ..." (golint)
    • Line 349: warning: exported method Worker.Shutdown should have comment or be unexported (golint)
    • Line 388: warning: comment on exported type WorkerDisconnectError should be of the form "WorkerDisconnectError ..." (with optional leading article) (golint)
    • Line 398: warning: comment on exported method WorkerDisconnectError.Reconnect should be of the form "Reconnect ..." (golint)
    • Line 403: warning: comment on exported method WorkerDisconnectError.Server should be of the form "Server ..." (golint)
    • g2/pkg/runtime/protocol.go
    • Line 75: warning: exported const Network should have comment (or a comment on this block) or be unexported (golint)
    • Line 76: warning: comment on exported const QueueSize should be of the form "QueueSize ..." (golint)
    • Line 78: warning: comment on exported const BufferSize should be of the form "BufferSize ..." (golint)
    • Line 80: warning: comment on exported const MinPacketLength should be of the form "MinPacketLength ..." (golint)
    • Line 83: warning: comment on exported const Req should be of the form "Req ..." (golint)
    • Line 86: warning: comment on exported const Res should be of the form "Res ..." (golint)
    • Line 95: warning: comment on exported const JobNormal should be of the form "JobNormal ..." (golint)
    • Line 97: warning: comment on exported const JobLow should be of the form "JobLow ..." (golint)
    • Line 99: warning: comment on exported const JobHigh should be of the form "JobHigh ..." (golint)
    • Line 103: warning: exported type PT should have comment or be unexported (golint)
    • Line 106: warning: don't use underscores in Go names; const PT_CanDo should be PTCanDo (golint)
    • Line 106: warning: exported const PT_CanDo should have comment (or a comment on this block) or be unexported (golint)
    • Line 107: warning: don't use underscores in Go names; const PT_CantDo should be PTCantDo (golint)
    • Line 108: warning: don't use underscores in Go names; const PT_ResetAbilities should be PTResetAbilities (golint)
    • Line 109: warning: don't use underscores in Go names; const PT_PreSleep should be PTPreSleep (golint)
    • Line 111: warning: don't use underscores in Go names; const PT_Noop should be PTNoop (golint)
    • Line 112: warning: don't use underscores in Go names; const PT_SubmitJob should be PTSubmitJob (golint)
    • Line 113: warning: don't use underscores in Go names; const PT_JobCreated should be PTJobCreated (golint)
    • Line 114: warning: don't use underscores in Go names; const PT_GrabJob should be PTGrabJob (golint)
    • Line 115: warning: don't use underscores in Go names; const PT_NoJob should be PTNoJob (golint)
    • Line 116: warning: don't use underscores in Go names; const PT_JobAssign should be PTJobAssign (golint)
    • Line 117: warning: don't use underscores in Go names; const PT_WorkStatus should be PTWorkStatus (golint)
    • Line 119: warning: comment on exported const PT_WorkComplete should be of the form "PT_WorkComplete ..." (golint)
    • Line 120: warning: don't use underscores in Go names; const PT_WorkComplete should be PTWorkComplete (golint)
    • Line 122: warning: comment on exported const PT_WorkFail should be of the form "PT_WorkFail ..." (golint)
    • Line 123: warning: don't use underscores in Go names; const PT_WorkFail should be PTWorkFail (golint)
    • Line 125: warning: comment on exported const PT_GetStatus should be of the form "PT_GetStatus ..." (golint)
    • Line 126: warning: don't use underscores in Go names; const PT_GetStatus should be PTGetStatus (golint)
    • Line 128: warning: don't use underscores in Go names; const PT_EchoReq should be PTEchoReq (golint)
    • Line 129: warning: don't use underscores in Go names; const PT_EchoRes should be PTEchoRes (golint)
    • Line 130: warning: don't use underscores in Go names; const PT_SubmitJobBG should be PTSubmitJobBG (golint)
    • Line 131: warning: don't use underscores in Go names; const PT_Error should be PTError (golint)
    • Line 132: warning: don't use underscores in Go names; const PT_StatusRes should be PTStatusRes (golint)
    • Line 133: warning: don't use underscores in Go names; const PT_SubmitJobHigh should be PTSubmitJobHigh (golint)
    • Line 134: warning: don't use underscores in Go names; const PT_SetClientId should be PTSetClientID (golint)
    • Line 135: warning: don't use underscores in Go names; const PT_CanDoTimeout should be PTCanDoTimeout (golint)
    • Line 136: warning: don't use underscores in Go names; const PT_AllYours should be PTAllYours (golint)
    • Line 137: warning: don't use underscores in Go names; const PT_WorkException should be PTWorkException (golint)
    • Line 139: warning: comment on exported const PT_OptionReq should be of the form "PT_OptionReq ..." (golint)
    • Line 140: warning: don't use underscores in Go names; const PT_OptionReq should be PTOptionReq (golint)
    • Line 142: warning: don't use underscores in Go names; const PT_OptionRes should be PTOptionRes (golint)
    • Line 143: warning: don't use underscores in Go names; const PT_WorkData should be PTWorkData (golint)
    • Line 145: warning: comment on exported const PT_WorkWarning should be of the form "PT_WorkWarning ..." (golint)
    • Line 146: warning: don't use underscores in Go names; const PT_WorkWarning should be PTWorkWarning (golint)
    • Line 148: warning: comment on exported const PT_GrabJobUniq should be of the form "PT_GrabJobUniq ..." (golint)
    • Line 149: warning: don't use underscores in Go names; const PT_GrabJobUniq should be PTGrabJobUniq (golint)
    • Line 151: warning: don't use underscores in Go names; const PT_JobAssignUniq should be PTJobAssignUniq (golint)
    • Line 152: warning: don't use underscores in Go names; const PT_SubmitJobHighBG should be PTSubmitJobHighBG (golint)
    • Line 153: warning: don't use underscores in Go names; const PT_SubmitJobLow should be PTSubmitJobLow (golint)
    • Line 154: warning: don't use underscores in Go names; const PT_SubmitJobLowBG should be PTSubmitJobLowBG (golint)
    • Line 155: warning: don't use underscores in Go names; const PT_SubmitJobSched should be PTSubmitJobSched (golint)
    • Line 156: warning: don't use underscores in Go names; const PT_SubmitJobEpoch should be PTSubmitJobEpoch (golint)
    • Line 158: warning: comment on exported const PT_SubmitReduceJob should be of the form "PT_SubmitReduceJob ..." (golint)
    • Line 159: warning: don't use underscores in Go names; const PT_SubmitReduceJob should be PTSubmitReduceJob (golint)
    • Line 160: warning: don't use underscores in Go names; const PT_SubmitReduceJobBackground should be PTSubmitReduceJobBackground (golint)
    • Line 161: warning: don't use underscores in Go names; const PT_GrabJobAll should be PTGrabJobAll (golint)
    • Line 162: warning: don't use underscores in Go names; const PT_JobAssignAll should be PTJobAssignAll (golint)
    • Line 163: warning: don't use underscores in Go names; const PT_GetStatusUnique should be PTGetStatusUnique (golint)
    • Line 164: warning: don't use underscores in Go names; const PT_StatusResUnique should be PTStatusResUnique (golint)
    • Line 167: warning: exported method PT.Int should have comment or be unexported (golint)
    • Line 171: warning: exported method PT.Uint32 should have comment or be unexported (golint)
    • Line 175: warning: exported function NewPT should have comment or be unexported (golint)
    • g2/pkg/storage/leveldb/leveldb.go
    • Line 15: warning: exported type LevelDbQ should have comment or be unexported (golint)
    • Line 21: warning: exported function New should have comment or be unexported (golint)
    • Line 29: warning: exported method LevelDbQ.Add should have comment or be unexported (golint)
    • Line 37: warning: exported method LevelDbQ.Delete should have comment or be unexported (golint)
    • Line 41: warning: exported method LevelDbQ.Get should have comment or be unexported (golint)
    • Line 53: warning: exported method LevelDbQ.GetAll should have comment or be unexported (golint)
    • g2/client/error.go
    • Line 10: warning: exported var ErrWorkWarning should have comment or be unexported (golint)
    • Line 29: warning: comment on exported type ErrorHandler should be of the form "ErrorHandler ..." (with optional leading article) (golint)
    • g2/worker/worker_disconnect_test.go
    • Line 16: warning: don't use underscores in Go names; var gearman_ready should be gearmanReady (golint)
    • Line 17: warning: don't use underscores in Go names; var kill_gearman should be killGearman (golint)
    • Line 31: warning: don't use underscores in Go names; func run_gearman should be runGearman (golint)
    • Line 32: warning: don't use underscores in Go names; var gm_cmd should be gmCmd (golint)
    • Line 33: warning: don't use underscores in Go names; var start_err should be startErr (golint)
    • Line 59: warning: don't use underscores in Go names; func check_gearman_present should be checkGearmanPresent (golint)
    • Line 68: warning: don't use underscores in Go names; func check_gearman_is_dead should be checkGearmanIsDead (golint)
    • Line 92: warning: don't use underscores in Go names; var work_done should be workDone (golint)
    • Line 102: warning: don't use underscores in Go names; var handled_errors should be handledErrors (golint)
    • Line 104: warning: don't use underscores in Go names; var c_error should be cError (golint)
    • Line 105: warning: don't use underscores in Go names; var was_dc_err should be wasDcErr (golint)
    • Line 167: warning: don't use underscores in Go names; var work_done should be workDone (golint)
    • Line 234: warning: don't use underscores in Go names; func send_client_request should be sendClientRequest (golint)
    • g2/pkg/server/server.go
    • Line 18: warning: should not use dot imports (golint)
    • Line 28: warning: exported type Config should have comment or be unexported (golint)
    • Line 34: warning: exported type Server should have comment or be unexported (golint)
    • Line 56: warning: exported function NewServer should have comment or be unexported (golint)
    • Line 130: warning: exported method Server.Start should have comment or be unexported (golint)
    • Line 794: warning: exported method Server.EvtLoop should have comment or be unexported (golint)
    • Line 805: warning: exported method Server.WatcherLoop should have comment or be unexported (golint)
    • Line 839: warning: exported method Server.WatchJobTimeout should have comment or be unexported (golint)
    • Line 869: warning: exported method Server.DeleteCronJob should have comment or be unexported (golint)
    • Line 880: warning: exported method Server.ExpressionToEpoch should have comment or be unexported (golint)
    • g2/pkg/runtime/cron.go
    • Line 12: warning: exported type CronSpecInterface should have comment or be unexported (golint)
    • Line 24: warning: exported function NewCronSchedule should have comment or be unexported (golint)
    • g2/client/client.go
    • Line 1: warning: package comment should be of the form "Package client ..." (golint)
    • Line 19: warning: exported var DefaultTimeout should have comment or be unexported (golint)
    • Line 22: warning: comment on exported type Client should be of the form "Client ..." (with optional leading article) (golint)
    • Line 66: warning: comment on exported function New should be of the form "New ..." (golint)
    • Line 254: warning: comment on exported method Client.Do should be of the form "Do ..." (golint)
    • Line 274: warning: comment on exported method Client.DoBg should be of the form "DoBg ..." (golint)
    • Line 290: warning: exported method Client.DoCron should have comment or be unexported (golint)
    • Line 299: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 322: warning: exported method Client.DoAt should have comment or be unexported (golint)
    • Line 331: warning: comment on exported method Client.Status should be of the form "Status ..." (golint)
    • Line 354: warning: comment on exported method Client.Echo should be of the form "Echo ..." (golint)
    • g2/worker/agent.go
    • Line 117: warning: don't use underscores in Go names; method disconnect_error should be disconnectError (golint)
    • g2/worker/func.go
    • Line 8: warning: comment on exported type JobHandler should be of the form "JobHandler ..." (with optional leading article) (golint)
    • Line 11: warning: exported type JobFunc should have comment or be unexported (golint)
    • Line 28: warning: exported function SysInfo should have comment or be unexported (golint)
    • Line 42: warning: exported function MemInfo should have comment or be unexported (golint)
    • g2/example/worker/worker.go
    • Line 14: warning: exported function ToUpper should have comment or be unexported (golint)
    • Line 20: warning: exported function ToUpperDelay10 should have comment or be unexported (golint)
    • Line 27: warning: exported function Foobar should have comment or be unexported (golint)
    • g2/worker/worker_test.go
    • Line 151: warning: don't use underscores in Go names; var other_worker should be otherWorker (golint)
    • Line 204: warning: don't use underscores in Go names; var other_worker should be otherWorker (golint)
    • g2/pkg/server/session.go
    • Line 10: warning: should not use dot imports (golint)
    • Line 33: warning: receiver name se should be consistent with previous receiver name s for session (golint)
    • Line 68: warning: receiver name se should be consistent with previous receiver name s for session (golint)
    • Line 181: warning: receiver name se should be consistent with previous receiver name s for session (golint)
    • g2/pkg/runtime/common.go
    • Line 43: warning: exported method PT.ArgCount should have comment or be unexported (golint)
    • Line 52: warning: exported function NewBuffer should have comment or be unexported (golint)
    • g2/worker/metrics.go
    • Line 3: warning: exported method Worker.Running should have comment or be unexported (golint)
    • Line 10: warning: exported method Worker.Agents should have comment or be unexported (golint)
    • g2/gearadmin/gearadmin.go
    • Line 30: warning: exported type PriorityStatus should have comment or be unexported (golint)
    • Line 78: warning: exported method GearmanAdmin.PriorityStatus should have comment or be unexported (golint)
    • Line 137: warning: exported method GearmanAdmin.Cancel should have comment or be unexported (golint)
    • g2/pkg/runtime/job.go
    • Line 8: warning: exported const PRIORITY_LOW should have comment (or a comment on this block) or be unexported (golint)
    • Line 16: warning: exported type Job should have comment or be unexported (golint)
    • Line 34: warning: exported type CronJob should have comment or be unexported (golint)
    • Line 46: warning: exported method Job.Key should have comment or be unexported (golint)
    • Line 50: warning: exported method Job.Prefix should have comment or be unexported (golint)
    • Line 54: warning: exported method CronJob.Key should have comment or be unexported (golint)
    • Line 58: warning: exported method CronJob.Prefix should have comment or be unexported (golint)
    • g2/client/pool.go
    • Line 14: warning: exported var ErrNotFound should have comment or be unexported (golint)
    • Line 17: warning: exported type PoolClient should have comment or be unexported (golint)
    • Line 23: warning: exported type SelectionHandler should have comment or be unexported (golint)
    • Line 25: warning: exported function SelectWithRate should have comment or be unexported (golint)
    • Line 37: warning: exported function SelectRandom should have comment or be unexported (golint)
    • Line 50: warning: exported type Pool should have comment or be unexported (golint)
    • Line 60: warning: comment on exported function NewPool should be of the form "NewPool ..." (golint)
    • Line 94: warning: exported method Pool.Do should have comment or be unexported (golint)
    • Line 104: warning: exported method Pool.DoBg should have comment or be unexported (golint)
    • Line 114: warning: comment on exported method Pool.Status should be of the form "Status ..." (golint)
    • Line 127: warning: comment on exported method Pool.Echo should be of the form "Echo ..." (golint)
    • Line 145: warning: comment on exported method Pool.Close should be of the form "Close ..." (golint)
    • g2/pkg/server/client.go
    • Line 7: warning: exported type Session should have comment or be unexported (golint)
    • Line 13: warning: exported type Client should have comment or be unexported (golint)
    • Line 17: warning: exported method Session.Send should have comment or be unexported (golint)
    • g2/pkg/server/metrics.go
    • Line 3: warning: exported method Server.Stats should have comment or be unexported (golint)
    • Line 16: warning: exported method Server.Workers should have comment or be unexported (golint)
    • Line 20: warning: exported method Server.Jobs should have comment or be unexported (golint)
    • Line 24: warning: exported method Server.Clients should have comment or be unexported (golint)
    • Line 28: warning: exported method Server.RunningJobsByWorker should have comment or be unexported (golint)
    • Line 36: warning: exported method Server.RunningJobsByFunction should have comment or be unexported (golint)
    • g2/pkg/server/util.go
    • Line 21: warning: error var invalidMagic should have name of the form errFoo (golint)
    • Line 22: warning: error var invalidArg should have name of the form errFoo (golint)
    • Line 25: warning: exported type AP should have comment or be unexported (golint)
    • Line 28: warning: don't use underscores in Go names; const AP_Workers should be APWorkers (golint)
    • Line 28: warning: exported const AP_Workers should have comment (or a comment on this block) or be unexported (golint)
    • Line 29: warning: don't use underscores in Go names; const AP_Status should be APStatus (golint)
    • Line 30: warning: don't use underscores in Go names; const AP_Cancel should be APCancel (golint)
    • Line 31: warning: don't use underscores in Go names; const AP_Show should be APShow (golint)
    • Line 32: warning: don't use underscores in Go names; const AP_Create should be APCreate (golint)
    • Line 33: warning: don't use underscores in Go names; const AP_Drop should be APDrop (golint)
    • Line 34: warning: don't use underscores in Go names; const AP_MaxQueue should be APMaxQueue (golint)
    • Line 35: warning: don't use underscores in Go names; const AP_GetPid should be APGetPid (golint)
    • Line 36: warning: don't use underscores in Go names; const AP_Shutdown should be APShutdown (golint)
    • Line 37: warning: don't use underscores in Go names; const AP_Verbose should be APVerbose (golint)
    • Line 38: warning: don't use underscores in Go names; const AP_Version should be APVersion (golint)
    • Line 89: warning: exported function IsValidJobHandle should have comment or be unexported (golint)
    • Line 93: warning: exported function IsValidCronJobHandle should have comment or be unexported (golint)
    • Line 110: warning: exported type Tuple should have comment or be unexported (golint)
    • Line 232: warning: exported function ReadMessage should have comment or be unexported (golint)
    • Line 248: warning: exported function ParseTextMessage should have comment or be unexported (golint)
    • Line 336: warning: exported function LocalIP should have comment or be unexported (golint)
    • g2/client/id.go
    • Line 10: warning: comment on exported var IdGen should be of the form "IdGen ..." (golint)
    • Line 19: warning: comment on exported type IdGenerator should be of the form "IdGenerator ..." (with optional leading article) (golint)
    • Line 35: warning: comment on exported function NewAutoIncId should be of the form "NewAutoIncId ..." (golint)
    • g2/client/status.go
    • Line 3: warning: comment on exported type StatusHandler should be of the form "StatusHandler ..." (with optional leading article) (golint)
    • Line 7: warning: exported type Status should have comment or be unexported (golint)
    • g2/pkg/metrics/server_metrics.go
    • Line 11: warning: exported type ServerData should have comment or be unexported (golint)
    • Line 20: warning: comment on exported function NewServerCollector should be of the form "NewServerCollector ..." (golint)
    • g2/pkg/storage/storage.go
    • Line 3: warning: exported type Db should have comment or be unexported (golint)
    • Line 7: warning: exported type DbItem should have comment or be unexported (golint)
    • Line 12: warning: exported type ItemQueue should have comment or be unexported (golint)
    • g2/client/response.go
    • Line 12: warning: comment on exported type ResponseHandler should be of the form "ResponseHandler ..." (with optional leading article) (golint)
    • Line 15: warning: comment on exported type Response should be of the form "Response ..." (with optional leading article) (golint)
    • Line 22: warning: comment on exported method Response.Result should be of the form "Result ..." (golint)
    • Line 44: warning: comment on exported method Response.Update should be of the form "Update ..." (golint)
    • Line 110: warning: exported method Response.Status should have comment or be unexported (golint)
    • g2/client/util.go
    • Line 17: warning: exported var Minute should have comment or be unexported (golint)
    • Line 24: warning: exported function ToEpoch should have comment or be unexported (golint)
    • g2/worker/error.go
    • Line 10: warning: exported var ErrNoneAgents should have comment or be unexported (golint)
    • Line 27: warning: comment on exported type ErrorHandler should be of the form "ErrorHandler ..." (with optional leading article) (golint)
    • g2/pkg/server/worker.go
    • Line 8: warning: should not use dot imports (golint)
    • Line 30: warning: exported type Worker should have comment or be unexported (golint)
    • Line 40: warning: exported method Worker.MarshalJSON should have comment or be unexported (golint)
    • g2/doc.go
    • Line 5: warning: package comment should be of the form "Package g2 ..." (golint)
    • Line 22: warning: a blank import should be only in a main or test package, or have a comment justifying it (golint)

gocyclo94%

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.

    • g2/pkg/server/session.go
    • Line 181: warning: cyclomatic complexity 26 of function (*session).handleAdminConnection() is high (> 15) (gocyclo)
    • Line 68: warning: cyclomatic complexity 23 of function (*session).handleBinaryConnection() is high (> 15) (gocyclo)

ineffassign100%

IneffAssign detects ineffectual assignments in Go code.

No problems detected. Good job!


license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


misspell92%

Misspell Finds commonly misspelled English words