Preparing report...

Report for github.com/haormj/util

A+    Excellent!    Found 26 issues across 51 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!


golint54%

Golint is a linter for Go source code.

    • util/cache/ttl/ttl.go
    • Line 9: warning: exported type TtlCache should have comment or be unexported (golint)
    • Line 14: warning: exported function NewTtlCache should have comment or be unexported (golint)
    • Line 24: warning: exported method TtlCache.Set should have comment or be unexported (golint)
    • Line 29: warning: exported method TtlCache.Get should have comment or be unexported (golint)
    • Line 33: warning: exported method TtlCache.Delete should have comment or be unexported (golint)
    • Line 37: warning: exported method TtlCache.Clear should have comment or be unexported (golint)
    • util/cache/lru/lru.go
    • Line 17: warning: exported function NewLruCache should have comment or be unexported (golint)
    • Line 30: warning: exported method LruCache.Set should have comment or be unexported (golint)
    • Line 36: warning: exported method LruCache.Delete should have comment or be unexported (golint)
    • Line 42: warning: exported method LruCache.Get should have comment or be unexported (golint)
    • Line 48: warning: exported method LruCache.Clear should have comment or be unexported (golint)
    • util/crypto/aes/cbc.go
    • Line 8: warning: exported function CBCEncrypt should have comment or be unexported (golint)
    • Line 20: warning: exported function CBCDecrypt should have comment or be unexported (golint)
    • util/unit.go
    • Line 5: warning: exported const KB should have comment (or a comment on this block) or be unexported (golint)
    • util/uuid.go
    • Line 9: warning: exported function GetUUIDV1 should have comment or be unexported (golint)
    • Line 13: warning: exported function GetUUIDV1WithoutLine should have comment or be unexported (golint)
    • util/invoker/dummy/invoker.go
    • Line 9: warning: exported type Invoker should have comment or be unexported (golint)
    • Line 13: warning: exported function NewInvoker should have comment or be unexported (golint)
    • Line 26: warning: exported method Invoker.Name should have comment or be unexported (golint)
    • Line 30: warning: exported method Invoker.Init should have comment or be unexported (golint)
    • Line 37: warning: receiver name f should be consistent with previous receiver name d for Invoker (golint)
    • Line 42: warning: exported method Invoker.Invoke should have comment or be unexported (golint)
    • Line 57: warning: exported method Invoker.Function should have comment or be unexported (golint)
    • Line 61: warning: exported method Invoker.Functions should have comment or be unexported (golint)
    • util/invoker/invoker.go
    • Line 9: warning: exported type Invoker should have comment or be unexported (golint)
    • Line 18: warning: exported type Message should have comment or be unexported (golint)
    • Line 28: warning: exported type Function should have comment or be unexported (golint)
    • Line 34: warning: exported type InvokeFunc should have comment or be unexported (golint)
    • Line 36: warning: exported type Interceptor should have comment or be unexported (golint)
    • Line 45: warning: exported function NewMessage should have comment or be unexported (golint)
    • util/invoker/options.go
    • Line 3: warning: exported type Options should have comment or be unexported (golint)
    • Line 8: warning: exported type Option should have comment or be unexported (golint)
    • Line 10: warning: exported type InvokeOptions should have comment or be unexported (golint)
    • Line 14: warning: exported type InvokeOption should have comment or be unexported (golint)
    • Line 16: warning: exported function Name should have comment or be unexported (golint)
    • Line 22: warning: exported function Intercept should have comment or be unexported (golint)
    • Line 28: warning: exported function WithInterceptor should have comment or be unexported (golint)
    • util/log/logger.go
    • Line 14: warning: exported type Logger should have comment or be unexported (golint)
    • Line 34: warning: exported function SetLogger should have comment or be unexported (golint)
    • Line 38: warning: exported function SetDummyLogger should have comment or be unexported (golint)
    • Line 42: warning: exported function Debug should have comment or be unexported (golint)
    • Line 45: warning: exported function Debugf should have comment or be unexported (golint)
    • Line 49: warning: exported function Info should have comment or be unexported (golint)
    • Line 52: warning: exported function Infof should have comment or be unexported (golint)
    • Line 56: warning: exported function Warn should have comment or be unexported (golint)
    • Line 59: warning: exported function Warnf should have comment or be unexported (golint)
    • Line 63: warning: exported function Error should have comment or be unexported (golint)
    • Line 66: warning: exported function Errorf should have comment or be unexported (golint)
    • Line 70: warning: exported function Fatal should have comment or be unexported (golint)
    • Line 73: warning: exported function Fatalf should have comment or be unexported (golint)
    • Line 77: warning: exported function Panic should have comment or be unexported (golint)
    • Line 80: warning: exported function Panicf should have comment or be unexported (golint)
    • util/tree.go
    • Line 74: warning: exported method Tree.Insert should have comment or be unexported (golint)
    • Line 91: warning: exported function NewNode should have comment or be unexported (golint)
    • Line 181: warning: exported method Node.Put should have comment or be unexported (golint)
    • Line 185: warning: exported method Node.Get should have comment or be unexported (golint)
    • Line 190: warning: exported method Node.Search should have comment or be unexported (golint)
    • Line 205: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 213: warning: exported method Node.Insert should have comment or be unexported (golint)
    • Line 243: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • util/example/invoker/main.go
    • Line 12: warning: exported type Test should have comment or be unexported (golint)
    • Line 15: warning: exported method Test.SayHello should have comment or be unexported (golint)
    • Line 21: warning: exported function SayWorld should have comment or be unexported (golint)
    • Line 32: warning: exported function TestReceiver should have comment or be unexported (golint)
    • Line 54: warning: exported function TestFunction should have comment or be unexported (golint)
    • util/cache/lru/options.go
    • Line 3: warning: exported type Options should have comment or be unexported (golint)
    • Line 7: warning: exported type Option should have comment or be unexported (golint)
    • Line 21: warning: exported function MaxEntries should have comment or be unexported (golint)
    • util/crypto/aes/pkcs7.go
    • Line 7: warning: exported function PKCS7Padding should have comment or be unexported (golint)
    • Line 13: warning: exported function PKCS7UnPadding should have comment or be unexported (golint)
    • util/cache/options.go
    • Line 7: warning: exported type Options should have comment or be unexported (golint)
    • Line 11: warning: exported type Option should have comment or be unexported (golint)
    • util/array.go
    • Line 66: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • Line 77: warning: if block ends with a return statement, so drop this else and outdent its block (golint)
    • util/period.go
    • Line 9: warning: exported var ErrPeriodInvalid should have comment or be unexported (golint)
    • Line 23: warning: exported method Period.St should have comment or be unexported (golint)
    • Line 27: warning: exported method Period.Et should have comment or be unexported (golint)
    • util/redir_iptables.go
    • Line 11: warning: exported const SO_ORIGINAL_DST should have comment (or a comment on this block) or be unexported (golint)
    • util/string.go
    • Line 8: warning: exported type SecurityString should have comment or be unexported (golint)
    • Line 13: warning: exported function NewSecurityString should have comment or be unexported (golint)
    • Line 17: warning: exported method SecurityString.Set should have comment or be unexported (golint)
    • Line 23: warning: exported method SecurityString.Get should have comment or be unexported (golint)
    • util/cache/ttl/options.go
    • Line 7: warning: exported type Options should have comment or be unexported (golint)
    • Line 11: warning: exported type Option should have comment or be unexported (golint)
    • Line 25: warning: exported function CleanupInterval should have comment or be unexported (golint)
    • util/cache/cache.go
    • Line 16: warning: exported type BaseCache should have comment or be unexported (golint)
    • Line 23: warning: exported function NewCache should have comment or be unexported (golint)
    • util/invoker/receiver/invoker.go
    • Line 19: warning: exported type ReceiverInvoker should have comment or be unexported (golint)
    • Line 183: warning: exported function NewInvoker should have comment or be unexported (golint)
    • Line 197: warning: exported method ReceiverInvoker.Init should have comment or be unexported (golint)
    • Line 263: warning: exported method ReceiverInvoker.Name should have comment or be unexported (golint)
    • Line 267: warning: exported method ReceiverInvoker.Invoke should have comment or be unexported (golint)
    • Line 282: warning: exported method ReceiverInvoker.Function should have comment or be unexported (golint)
    • Line 292: warning: exported method ReceiverInvoker.Functions should have comment or be unexported (golint)
    • util/invoker/function/invoker.go
    • Line 17: warning: exported type Invoker should have comment or be unexported (golint)
    • Line 131: warning: exported function NewInvoker should have comment or be unexported (golint)
    • Line 145: warning: exported method Invoker.Name should have comment or be unexported (golint)
    • Line 149: warning: exported method Invoker.Init should have comment or be unexported (golint)
    • Line 181: warning: receiver name f should be consistent with previous receiver name d for Invoker (golint)
    • Line 225: warning: exported method Invoker.Invoke should have comment or be unexported (golint)
    • Line 225: warning: receiver name f should be consistent with previous receiver name d for Invoker (golint)
    • Line 240: warning: exported method Invoker.Function should have comment or be unexported (golint)
    • Line 240: warning: receiver name f should be consistent with previous receiver name d for Invoker (golint)
    • Line 244: warning: exported method Invoker.Functions should have comment or be unexported (golint)

gocyclo90%

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.

    • util/struct.go
    • Line 93: warning: cyclomatic complexity 46 of function SetStructField() is high (> 15) (gocyclo)
    • util/period.go
    • Line 217: warning: cyclomatic complexity 29 of function PeriodDifference() is high (> 15) (gocyclo)
    • Line 144: warning: cyclomatic complexity 22 of function PeriodIntersection() is high (> 15) (gocyclo)
    • Line 79: warning: cyclomatic complexity 21 of function PeriodUnion() is high (> 15) (gocyclo)
    • util/reflect_type.go
    • Line 73: warning: cyclomatic complexity 21 of function InitWithZeroValueExcludePtr() is high (> 15) (gocyclo)
    • Line 24: warning: cyclomatic complexity 19 of function InitWithZeroValue() 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!


misspell100%

Misspell Finds commonly misspelled English words

No problems detected. Good job!