Preparing report...

Report for github.com/LENSHOOD/go-raft

(v0.0.0-20211221144648-e63af95fa8dc)

A+    Excellent!    Found 12 issues across 22 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!


gocyclo100%

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.

No problems detected. Good job!


golint50%

Golint is a linter for Go source code.

    • core/leader.go
    • Line 9: warning: exported type Leader should have comment or be unexported (golint)
    • Line 18: warning: exported method Leader.TakeAction should have comment or be unexported (golint)
    • Line 277: warning: exported function NewLeader should have comment or be unexported (golint)
    • core/raft.go
    • Line 7: warning: exported type Address should have comment or be unexported (golint)
    • Line 9: warning: exported const InvalidId should have comment or be unexported (golint)
    • Line 11: warning: exported const All should have comment or be unexported (golint)
    • Line 13: warning: exported const Composed should have comment or be unexported (golint)
    • Line 21: warning: exported type Term should have comment or be unexported (golint)
    • Line 22: warning: exported type Index should have comment or be unexported (golint)
    • Line 23: warning: exported type Command should have comment or be unexported (golint)
    • Line 25: warning: exported type Entry should have comment or be unexported (golint)
    • Line 31: warning: exported type RaftObject should have comment or be unexported (golint)
    • Line 37: warning: exported type Cluster should have comment or be unexported (golint)
    • Line 63: warning: exported type Config should have comment or be unexported (golint)
    • Line 72: warning: exported function InitConfig should have comment or be unexported (golint)
    • Line 83: warning: exported type RaftBase should have comment or be unexported (golint)
    • Line 112: warning: exported method RaftBase.Resp should have comment or be unexported (golint)
    • Line 143: warning: exported var InvalidEntry should have comment or be unexported (golint)
    • Line 178: warning: exported method RaftBase.GetAllEntries should have comment or be unexported (golint)
    • Line 182: warning: exported method RaftBase.GetCluster should have comment or be unexported (golint)
    • core/follower.go
    • Line 3: warning: exported type Follower should have comment or be unexported (golint)
    • Line 5: warning: exported function NewFollower should have comment or be unexported (golint)
    • Line 10: warning: exported method Follower.TakeAction should have comment or be unexported (golint)
    • api/mapper.go
    • Line 49: warning: exported function MapToAppendEntriesReq should have comment or be unexported (golint)
    • Line 64: warning: exported function MapToAppendEntriesArguments should have comment or be unexported (golint)
    • Line 79: warning: exported function MapToAppendEntriesResp should have comment or be unexported (golint)
    • Line 90: warning: exported function MapToAppendEntriesResults should have comment or be unexported (golint)
    • Line 101: warning: exported function MapToRequestVoteReq should have comment or be unexported (golint)
    • Line 114: warning: exported function MapToRequestVoteArguments should have comment or be unexported (golint)
    • Line 127: warning: exported function MapToRequestVoteResp should have comment or be unexported (golint)
    • Line 138: warning: exported function MapToRequestVoteResults should have comment or be unexported (golint)
    • Line 149: warning: exported function MapToCmdReq should have comment or be unexported (golint)
    • Line 159: warning: exported function MapToCmdRequest should have comment or be unexported (golint)
    • Line 169: warning: exported function MapToCmdResp should have comment or be unexported (golint)
    • Line 180: warning: exported function MapToCmdResponse should have comment or be unexported (golint)
    • api/server.go
    • Line 17: warning: exported type RaftServer should have comment or be unexported (golint)
    • Line 23: warning: exported function NewServer should have comment or be unexported (golint)
    • Line 30: warning: exported method RaftServer.RequestVote should have comment or be unexported (golint)
    • Line 34: warning: exported method RaftServer.AppendEntries should have comment or be unexported (golint)
    • Line 38: warning: exported method RaftServer.ExecCmd should have comment or be unexported (golint)
    • Line 61: warning: exported type Caller should have comment or be unexported (golint)
    • Line 68: warning: exported function NewCaller should have comment or be unexported (golint)
    • Line 80: warning: exported method Caller.Run should have comment or be unexported (golint)
    • mgr/raft_mgr.go
    • Line 17: warning: exported type Rpc should have comment or be unexported (golint)
    • Line 23: warning: exported type ConfigOp should have comment or be unexported (golint)
    • Line 26: warning: exported const Add should have comment (or a comment on this block) or be unexported (golint)
    • Line 30: warning: exported type ConfigChange should have comment or be unexported (golint)
    • Line 35: warning: exported type Config should have comment or be unexported (golint)
    • Line 132: warning: exported type Ticker should have comment or be unexported (golint)
    • Line 155: warning: exported function NewDefaultTicker should have comment or be unexported (golint)
    • Line 165: warning: exported type RaftManager should have comment or be unexported (golint)
    • Line 174: warning: exported method RaftManager.Run should have comment or be unexported (golint)
    • Line 272: warning: exported method RaftManager.Stop should have comment or be unexported (golint)
    • Line 325: warning: exported method RaftManager.IsLeader should have comment or be unexported (golint)
    • Line 331: warning: exported method RaftManager.IsCandidate should have comment or be unexported (golint)
    • Line 337: warning: exported method RaftManager.IsFollower should have comment or be unexported (golint)
    • Line 343: warning: exported method RaftManager.GetAllEntries should have comment or be unexported (golint)
    • Line 348: warning: exported method RaftManager.GetOthers should have comment or be unexported (golint)
    • Line 353: warning: exported function NewRaftMgr should have comment or be unexported (golint)
    • Line 357: warning: exported function NewRaftMgrWithTicker should have comment or be unexported (golint)
    • core/actions.go
    • Line 3: warning: exported type MsgType should have comment or be unexported (golint)
    • Line 6: warning: exported const Tick should have comment (or a comment on this block) or be unexported (golint)
    • Line 13: warning: exported type Msg should have comment or be unexported (golint)
    • Line 20: warning: exported var NullMsg should have comment or be unexported (golint)
    • Line 22: warning: exported type TermHolder should have comment or be unexported (golint)
    • Line 26: warning: exported type RequestVoteReq should have comment or be unexported (golint)
    • Line 34: warning: exported method RequestVoteReq.GetTerm should have comment or be unexported (golint)
    • Line 38: warning: exported type RequestVoteResp should have comment or be unexported (golint)
    • Line 43: warning: exported method RequestVoteResp.GetTerm should have comment or be unexported (golint)
    • Line 47: warning: exported type AppendEntriesReq should have comment or be unexported (golint)
    • Line 56: warning: exported method AppendEntriesReq.GetTerm should have comment or be unexported (golint)
    • Line 60: warning: exported type AppendEntriesResp should have comment or be unexported (golint)
    • Line 65: warning: exported method AppendEntriesResp.GetTerm should have comment or be unexported (golint)
    • Line 69: warning: exported type CmdReq should have comment or be unexported (golint)
    • Line 73: warning: exported type CmdResp should have comment or be unexported (golint)
    • Line 91: warning: exported type TimeoutNowReq should have comment or be unexported (golint)
    • Line 95: warning: exported method TimeoutNowReq.GetTerm should have comment or be unexported (golint)
    • core/candidate.go
    • Line 7: warning: exported type Candidate should have comment or be unexported (golint)
    • Line 13: warning: exported method Candidate.TakeAction should have comment or be unexported (golint)
    • Line 86: warning: exported function NewCandidate should have comment or be unexported (golint)
    • state_machine/log_print_sm.go
    • Line 1: warning: don't use an underscore in package name (golint)
    • Line 11: warning: exported type LogPrintStateMachine should have comment or be unexported (golint)
    • Line 13: warning: exported method LogPrintStateMachine.Exec should have comment or be unexported (golint)
    • Line 17: warning: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary) (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign95%

IneffAssign detects ineffectual assignments in Go code.


misspell95%

Misspell Finds commonly misspelled English words