Preparing report...

Report for github.com/ant-libs-go/util

A    Great!    Found 15 issues across 13 files

Tweet

gofmt92%

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!


gocyclo84%

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/slice.go
    • Line 56: warning: cyclomatic complexity 21 of function SliceUnique() is high (> 15) (gocyclo)
    • Line 115: warning: cyclomatic complexity 20 of function SliceColumn() is high (> 15) (gocyclo)
    • util/misc.go
    • Line 29: warning: cyclomatic complexity 19 of function Assign() is high (> 15) (gocyclo)
    • Line 90: warning: cyclomatic complexity 16 of function StructIsEqual() is high (> 15) (gocyclo)

golint15%

Golint is a linter for Go source code.

    • util/type_convert.go
    • Line 12: warning: exported function StrToInt64 should have comment or be unexported (golint)
    • Line 20: warning: exported function Int64ToStr should have comment or be unexported (golint)
    • Line 24: warning: exported function StrToInt32 should have comment or be unexported (golint)
    • Line 28: warning: exported function Int32ToStr should have comment or be unexported (golint)
    • Line 32: warning: exported function StrToInt should have comment or be unexported (golint)
    • Line 36: warning: exported function IntToStr should have comment or be unexported (golint)
    • Line 40: warning: exported function StrToFloat64 should have comment or be unexported (golint)
    • Line 48: warning: exported function Float64ToStr should have comment or be unexported (golint)
    • Line 52: warning: exported function StrToFloat32 should have comment or be unexported (golint)
    • Line 60: warning: exported function Float32ToStr should have comment or be unexported (golint)
    • Line 64: warning: exported function Int64ToBase32 should have comment or be unexported (golint)
    • Line 69: warning: exported function Base32ToInt64 should have comment or be unexported (golint)
    • util/version.go
    • Line 16: warning: exported function VersionStringToInt should have comment or be unexported (golint)
    • Line 28: warning: exported function VersionIntToString should have comment or be unexported (golint)
    • Line 38: warning: exported function CompareVersion should have comment or be unexported (golint)
    • util/integer.go
    • Line 10: warning: exported function MaxInt64 should have comment or be unexported (golint)
    • Line 17: warning: exported function MinInt64 should have comment or be unexported (golint)
    • Line 24: warning: exported function MaxInt32 should have comment or be unexported (golint)
    • Line 31: warning: exported function MinInt32 should have comment or be unexported (golint)
    • util/map.go
    • Line 14: warning: exported function JoinMap should have comment or be unexported (golint)
    • Line 23: warning: exported function MapToQueryStr should have comment or be unexported (golint)
    • Line 32: warning: exported function QueryStrToMap should have comment or be unexported (golint)
    • Line 44: warning: exported function MapKeys should have comment or be unexported (golint)
    • Line 45: warning: should omit 2nd value from range; this loop is equivalent to `for k := range ...` (golint)
    • util/misc.go
    • Line 23: warning: comment on exported function Assign should be of the form "Assign ..." (golint)
    • Line 40: warning: don't use underscores in Go names; var val_origin should be valOrigin (golint)
    • Line 41: warning: don't use underscores in Go names; var val_target should be valTarget (golint)
    • Line 49: warning: don't use underscores in Go names; var is_valid should be isValid (golint)
    • Line 84: warning: comment on exported function StructIsEqual should be of the form "StructIsEqual ..." (golint)
    • Line 91: warning: don't use underscores in Go names; var val_origin should be valOrigin (golint)
    • Line 92: warning: don't use underscores in Go names; var val_target should be valTarget (golint)
    • Line 140: warning: exported function DateRange should have comment or be unexported (golint)
    • Line 154: warning: exported function DeepCopy should have comment or be unexported (golint)
    • Line 162: warning: exported function GenRandomId should have comment or be unexported (golint)
    • Line 166: warning: exported function GetRandomString should have comment or be unexported (golint)
    • Line 177: warning: comment on exported function Goid should be of the form "Goid ..." (golint)
    • Line 197: warning: comment on exported function GetLocalIP should be of the form "GetLocalIP ..." (golint)
    • Line 217: warning: exported function If should have comment or be unexported (golint)
    • Line 224: warning: exported function IfDo should have comment or be unexported (golint)
    • Line 230: warning: comment on exported function FirstTimeOfWeek should be of the form "FirstTimeOfWeek ..." (golint)
    • Line 240: warning: comment on exported function FirstTimeOfDay should be of the form "FirstTimeOfDay ..." (golint)
    • util/float.go
    • Line 12: warning: exported const MIN should have comment or be unexported (golint)
    • Line 14: warning: exported function FloatIsEqual 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 (golint)
    • util/slice.go
    • Line 16: warning: exported function InSlice should have comment or be unexported (golint)
    • Line 35: warning: exported function SliceDiff should have comment or be unexported (golint)
    • Line 56: warning: exported function SliceUnique should have comment or be unexported (golint)
    • Line 115: warning: exported function SliceColumn should have comment or be unexported (golint)
    • Line 171: warning: exported function SliceTrim should have comment or be unexported (golint)
    • Line 185: warning: exported function SliceSumInt should have comment or be unexported (golint)
    • Line 192: warning: exported function SliceShuffle should have comment or be unexported (golint)
    • util/string.go
    • Line 23: warning: comment on exported function CamelString should be of the form "CamelString ..." (golint)
    • Line 48: warning: comment on exported function SnakeString should be of the form "SnakeString ..." (golint)
    • Line 66: warning: comment on exported function FindStringSubmatch should be of the form "FindStringSubmatch ..." (golint)
    • Line 83: warning: exported function Md5String should have comment or be unexported (golint)
    • Line 89: warning: exported function Sha1String should have comment or be unexported (golint)
    • Line 95: warning: exported function GzipString should have comment or be unexported (golint)
    • Line 109: warning: exported function UrlEncode should have comment or be unexported (golint)
    • Line 113: warning: exported function UrlDecode should have comment or be unexported (golint)
    • Line 121: warning: exported function Tprintf should have comment or be unexported (golint)
    • Line 128: warning: exported function BytesReplace should have comment or be unexported (golint)
    • util/logs/logs.go
    • Line 40: warning: exported type SessLog should have comment or be unexported (golint)
    • Line 53: warning: exported function New should have comment or be unexported (golint)
    • Line 74: warning: exported method SessLog.SetDummyLevel should have comment or be unexported (golint)
    • Line 74: warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (golint)
    • Line 78: warning: exported method SessLog.GetDummyLevel should have comment or be unexported (golint)
    • Line 78: warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (golint)
    • Line 82: warning: exported method SessLog.Release should have comment or be unexported (golint)
    • Line 82: warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (golint)
    • Line 89: warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (golint)
    • Line 110: warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (golint)
    • Line 115: warning: exported method SessLog.Tracef should have comment or be unexported (golint)
    • Line 115: warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (golint)
    • Line 122: warning: exported method SessLog.Debugf should have comment or be unexported (golint)
    • Line 122: warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (golint)
    • Line 129: warning: exported method SessLog.Infof should have comment or be unexported (golint)
    • Line 129: warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (golint)
    • Line 136: warning: exported method SessLog.Warnf should have comment or be unexported (golint)
    • Line 136: warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (golint)
    • Line 143: warning: exported method SessLog.Errorf should have comment or be unexported (golint)
    • Line 143: warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (golint)
    • Line 150: warning: exported method SessLog.Criticalf should have comment or be unexported (golint)
    • Line 150: warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (golint)
    • util/codec.go
    • Line 24: warning: exported function IntEncode should have comment or be unexported (golint)
    • Line 30: warning: exported function IntDecode should have comment or be unexported (golint)
    • Line 47: warning: exported function JsonEncode should have comment or be unexported (golint)
    • Line 51: warning: exported function JsonDecode should have comment or be unexported (golint)
    • Line 56: warning: exported function GobEncode should have comment or be unexported (golint)
    • Line 62: warning: exported function GobDecode should have comment or be unexported (golint)
    • Line 67: warning: exported function PbEncode should have comment or be unexported (golint)
    • Line 71: warning: exported function PbDecode should have comment or be unexported (golint)
    • Line 75: warning: exported function MsgpackEncode should have comment or be unexported (golint)
    • Line 81: warning: exported function MsgpackDecode should have comment or be unexported (golint)
    • Line 86: warning: exported function ThriftEncode should have comment or be unexported (golint)
    • Line 97: warning: exported function ThriftDecode should have comment or be unexported (golint)
    • Line 108: warning: comment on exported type SerializeValue should be of the form "SerializeValue ..." (with optional leading article) (golint)
    • Line 118: warning: exported function NewSerializeValue should have comment or be unexported (golint)
    • Line 123: warning: exported method SerializeValue.Map should have comment or be unexported (golint)
    • Line 123: warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (golint)
    • Line 130: warning: exported method SerializeValue.Slice should have comment or be unexported (golint)
    • Line 130: warning: receiver name should be a reflection of its identity; don't use generic names such as "this" or "self" (golint)
    • util/file.go
    • Line 25: warning: comment on exported function AbsPath should be of the form "AbsPath ..." (golint)
    • Line 33: warning: exported function PathExists should have comment or be unexported (golint)
    • Line 44: warning: comment on exported function WalkDir should be of the form "WalkDir ..." (golint)
    • Line 68: warning: comment on exported function Md5File should be of the form "Md5File ..." (golint)
    • Line 85: warning: comment on exported function SHA1File should be of the form "SHA1File ..." (golint)
    • Line 101: warning: comment on exported function SHA256File should be of the form "SHA256File ..." (golint)
    • Line 117: warning: exported function ReadFile should have comment or be unexported (golint)
    • Line 125: warning: exported function WriteFile should have comment or be unexported (golint)
    • Line 129: warning: exported function ReadLine should have comment or be unexported (golint)
    • Line 147: warning: exported function GetCurPath should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign69%

IneffAssign detects ineffectual assignments in Go code.

    • /home/shawn/go/pkg/mod/github.com/golang/protobuf@v1.4.3/proto/deprecated.go
    • Line 13: warning: missing go.sum entry for module providing package google.golang.org/protobuf/proto (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 13: warning: could not import google.golang.org/protobuf/proto (invalid package name: "") (ineffassign)
    • Line 13: warning: missing go.sum entry for module providing package google.golang.org/protobuf/proto (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 13: warning: could not import google.golang.org/protobuf/proto (invalid package name: "") (ineffassign)
    • /home/shawn/go/pkg/mod/github.com/golang/protobuf@v1.4.3/proto/defaults.go
    • Line 8: warning: missing go.sum entry for module providing package google.golang.org/protobuf/reflect/protoreflect (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 8: warning: could not import google.golang.org/protobuf/reflect/protoreflect (invalid package name: "") (ineffassign)
    • Line 8: warning: missing go.sum entry for module providing package google.golang.org/protobuf/reflect/protoreflect (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 8: warning: could not import google.golang.org/protobuf/reflect/protoreflect (invalid package name: "") (ineffassign)
    • /home/shawn/go/pkg/mod/github.com/golang/protobuf@v1.4.3/proto/extensions.go
    • Line 15: warning: missing go.sum entry for module providing package google.golang.org/protobuf/reflect/protoregistry (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 16: warning: missing go.sum entry for module providing package google.golang.org/protobuf/runtime/protoiface (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 15: warning: could not import google.golang.org/protobuf/reflect/protoregistry (invalid package name: "") (ineffassign)
    • Line 16: warning: could not import google.golang.org/protobuf/runtime/protoiface (invalid package name: "") (ineffassign)
    • Line 15: warning: missing go.sum entry for module providing package google.golang.org/protobuf/reflect/protoregistry (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 16: warning: missing go.sum entry for module providing package google.golang.org/protobuf/runtime/protoiface (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 15: warning: could not import google.golang.org/protobuf/reflect/protoregistry (invalid package name: "") (ineffassign)
    • Line 16: warning: could not import google.golang.org/protobuf/runtime/protoiface (invalid package name: "") (ineffassign)
    • /home/shawn/go/pkg/mod/github.com/golang/protobuf@v1.4.3/proto/buffer.go
    • Line 11: warning: missing go.sum entry for module providing package google.golang.org/protobuf/encoding/prototext (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 12: warning: missing go.sum entry for module providing package google.golang.org/protobuf/encoding/protowire (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 13: warning: missing go.sum entry for module providing package google.golang.org/protobuf/runtime/protoimpl (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 11: warning: could not import google.golang.org/protobuf/encoding/prototext (invalid package name: "") (ineffassign)
    • Line 12: warning: could not import google.golang.org/protobuf/encoding/protowire (invalid package name: "") (ineffassign)
    • Line 13: warning: could not import google.golang.org/protobuf/runtime/protoimpl (invalid package name: "") (ineffassign)
    • Line 11: warning: missing go.sum entry for module providing package google.golang.org/protobuf/encoding/prototext (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 12: warning: missing go.sum entry for module providing package google.golang.org/protobuf/encoding/protowire (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 13: warning: missing go.sum entry for module providing package google.golang.org/protobuf/runtime/protoimpl (imported by github.com/golang/protobuf/proto); to add: (ineffassign)
    • Line 11: warning: could not import google.golang.org/protobuf/encoding/prototext (invalid package name: "") (ineffassign)
    • Line 12: warning: could not import google.golang.org/protobuf/encoding/protowire (invalid package name: "") (ineffassign)
    • Line 13: warning: could not import google.golang.org/protobuf/runtime/protoimpl (invalid package name: "") (ineffassign)

misspell100%

Misspell Finds commonly misspelled English words

No problems detected. Good job!