Preparing report...

Report for github.com/AliyunContainerService/terway

A+    Excellent!    Found 27 issues across 72 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!


gocyclo86%

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.

    • terway/daemon/eni-multi-ip.go
    • Line 713: warning: cyclomatic complexity 19 of function newENIIPResourceManager() is high (> 15) (gocyclo)
    • Line 414: warning: cyclomatic complexity 17 of function (*eniIPFactory).initialENI() is high (> 15) (gocyclo)
    • Line 316: warning: cyclomatic complexity 16 of function (*eniIPFactory).Dispose() is high (> 15) (gocyclo)
    • terway/daemon/veth.go
    • Line 45: warning: cyclomatic complexity 16 of function (*vethResourceManager).GarbageCollection() is high (> 15) (gocyclo)
    • terway/plugin/terway/cni.go
    • Line 151: warning: cyclomatic complexity 54 of function cmdAdd() is high (> 15) (gocyclo)
    • Line 667: warning: cyclomatic complexity 28 of function cmdCheck() is high (> 15) (gocyclo)
    • Line 517: warning: cyclomatic complexity 23 of function cmdDel() is high (> 15) (gocyclo)
    • terway/daemon/daemon.go
    • Line 1015: warning: cyclomatic complexity 40 of function newNetworkService() is high (> 15) (gocyclo)
    • Line 659: warning: cyclomatic complexity 27 of function (*networkService).startGarbageCollectionLoop() is high (> 15) (gocyclo)
    • Line 186: warning: cyclomatic complexity 26 of function (*networkService).AllocIP() is high (> 15) (gocyclo)

golint72%

Golint is a linter for Go source code.

    • terway/pkg/ip/ip.go
    • Line 8: warning: exported function ToIP should have comment or be unexported (golint)
    • Line 16: warning: exported function ToIPs should have comment or be unexported (golint)
    • Line 28: warning: exported function IPv6 should have comment or be unexported (golint)
    • terway/pkg/aliyun/credential/meta.go
    • Line 8: warning: exported type MetadataProvider should have comment or be unexported (golint)
    • Line 16: warning: exported method MetadataProvider.Resolve should have comment or be unexported (golint)
    • Line 32: warning: exported method MetadataProvider.Name should have comment or be unexported (golint)
    • terway/types/types.go
    • Line 12: warning: exported type InternetChargeType should have comment or be unexported (golint)
    • Line 20: warning: exported type EIPInstanceType should have comment or be unexported (golint)
    • Line 22: warning: exported const EIPInstanceTypeNetworkInterface should have comment or be unexported (golint)
    • Line 47: warning: exported type IPFamily should have comment or be unexported (golint)
    • Line 52: warning: exported function NewIPFamilyFromIPStack should have comment or be unexported (golint)
    • Line 81: warning: exported method IPSet.ToRPC should have comment or be unexported (golint)
    • Line 95: warning: exported method IPSet.SetIP should have comment or be unexported (golint)
    • Line 108: warning: exported type IPNetSet should have comment or be unexported (golint)
    • Line 113: warning: exported method IPNetSet.ToRPC should have comment or be unexported (golint)
    • terway/plugin/driver/raw_nic.go
    • Line 20: warning: exported function NewRawNICDriver should have comment or be unexported (golint)
    • Line 28: warning: exported method RawNicDriver.Setup should have comment or be unexported (golint)
    • Line 102: warning: exported method RawNicDriver.Teardown should have comment or be unexported (golint)
    • Line 137: warning: exported method RawNicDriver.Check should have comment or be unexported (golint)
    • terway/plugin/driver/veth.go
    • Line 37: warning: exported type VETHDriver should have comment or be unexported (golint)
    • Line 43: warning: exported function NewVETHDriver should have comment or be unexported (golint)
    • Line 51: warning: exported method VETHDriver.Setup should have comment or be unexported (golint)
    • Line 199: warning: exported method VETHDriver.Teardown should have comment or be unexported (golint)
    • Line 240: warning: exported method VETHDriver.Check should have comment or be unexported (golint)
    • terway/plugin/backend/mock.go
    • Line 11: warning: exported type ENI should have comment or be unexported (golint)
    • Line 25: warning: exported function NewIPAM should have comment or be unexported (golint)
    • Line 33: warning: exported method IPAM.Alloc should have comment or be unexported (golint)
    • Line 51: warning: exported method IPAM.Release should have comment or be unexported (golint)
    • Line 62: warning: exported function NewMock should have comment or be unexported (golint)
    • Line 134: warning: exported method Mock.AllocIP should have comment or be unexported (golint)
    • Line 165: warning: exported method Mock.ReleaseIP should have comment or be unexported (golint)
    • Line 172: warning: exported method Mock.GetIPInfo should have comment or be unexported (golint)
    • Line 178: warning: exported method Mock.RecordEvent should have comment or be unexported (golint)
    • terway/pkg/aliyun/credential/ak.go
    • Line 9: warning: exported type AKPairProvider should have comment or be unexported (golint)
    • Line 14: warning: exported function NewAKPairProvider should have comment or be unexported (golint)
    • Line 18: warning: exported method AKPairProvider.Resolve should have comment or be unexported (golint)
    • Line 28: warning: exported method AKPairProvider.Name should have comment or be unexported (golint)
    • terway/types/helper.go
    • Line 11: warning: exported function BuildIPNet should have comment or be unexported (golint)
    • Line 42: warning: exported function ToIPSet should have comment or be unexported (golint)
    • Line 63: warning: exported function ToIPNetSet should have comment or be unexported (golint)
    • terway/plugin/driver/drivers.go
    • Line 12: warning: exported type RecordPodEvent should have comment or be unexported (golint)
    • Line 14: warning: exported type SetupConfig should have comment or be unexported (golint)
    • Line 34: warning: exported type TeardownCfg should have comment or be unexported (golint)
    • Line 41: warning: exported type CheckConfig should have comment or be unexported (golint)
    • terway/plugin/driver/netlink.go
    • Line 27: warning: exported function NetlinkFamily should have comment or be unexported (golint)
    • Line 34: warning: exported function LinkSetName should have comment or be unexported (golint)
    • Line 44: warning: exported function LinkAdd should have comment or be unexported (golint)
    • Line 54: warning: exported function LinkSetUp should have comment or be unexported (golint)
    • Line 64: warning: exported function LinkSetDown should have comment or be unexported (golint)
    • Line 74: warning: exported function LinkDel should have comment or be unexported (golint)
    • Line 84: warning: exported function LinkSetMTU should have comment or be unexported (golint)
    • Line 94: warning: exported function AddrDel should have comment or be unexported (golint)
    • Line 104: warning: exported function AddrReplace should have comment or be unexported (golint)
    • Line 114: warning: exported function RouteAdd should have comment or be unexported (golint)
    • Line 124: warning: exported function RouteReplace should have comment or be unexported (golint)
    • Line 134: warning: exported function RouteDel should have comment or be unexported (golint)
    • Line 144: warning: exported function NeighAdd should have comment or be unexported (golint)
    • Line 154: warning: exported function RuleAdd should have comment or be unexported (golint)
    • Line 164: warning: exported function RuleDel should have comment or be unexported (golint)
    • Line 174: warning: exported function LinkSetNsFd should have comment or be unexported (golint)
    • terway/plugin/driver/ipvlan.go
    • Line 29: warning: exported type IPvlanDriver should have comment or be unexported (golint)
    • Line 35: warning: exported function NewIPVlanDriver should have comment or be unexported (golint)
    • Line 43: warning: exported method IPvlanDriver.Setup should have comment or be unexported (golint)
    • Line 140: warning: exported method IPvlanDriver.Teardown should have comment or be unexported (golint)
    • Line 182: warning: exported method IPvlanDriver.Check should have comment or be unexported (golint)
    • terway/pkg/pool/pool.go
    • Line 45: warning: exported type UsageIf should have comment or be unexported (golint)
    • Line 57: warning: exported method ResUsage.GetID should have comment or be unexported (golint)
    • Line 61: warning: exported method ResUsage.GetType should have comment or be unexported (golint)
    • Line 65: warning: exported method ResUsage.GetStatus should have comment or be unexported (golint)
    • Line 75: warning: exported method Usage.GetLocal should have comment or be unexported (golint)
    • Line 79: warning: exported method Usage.GetRemote should have comment or be unexported (golint)
    • terway/pkg/aliyun/eni.go
    • Line 25: warning: exported type ENIMetadata should have comment or be unexported (golint)
    • Line 30: warning: exported function NewENIMetadata should have comment or be unexported (golint)
    • Line 37: warning: exported method ENIMetadata.GetENIConfigByMac should have comment or be unexported (golint)
    • Line 99: warning: exported method ENIMetadata.GetENIConfigByID should have comment or be unexported (golint)
    • Line 116: warning: exported method ENIMetadata.GetENIPrivateAddressesByMAC should have comment or be unexported (golint)
    • Line 120: warning: exported method ENIMetadata.GetENIPrivateIPv6AddressesByMAC should have comment or be unexported (golint)
    • Line 124: warning: exported method ENIMetadata.GetAttachedENIs should have comment or be unexported (golint)
    • terway/pkg/aliyun/instance.go
    • Line 19: warning: exported type Instance should have comment or be unexported (golint)
    • Line 30: warning: exported function GetInstanceMeta should have comment or be unexported (golint)
    • terway/plugin/driver/utils.go
    • Line 36: warning: exported function NewDefaultLogger should have comment or be unexported (golint)
    • Line 47: warning: exported function SetLogDebug should have comment or be unexported (golint)
    • Line 61: warning: exported type Locker should have comment or be unexported (golint)
    • Line 139: warning: exported function EnsureLinkName should have comment or be unexported (golint)
    • Line 195: warning: exported function EnsureDefaultRoute should have comment or be unexported (golint)
    • Line 218: warning: exported function EnsureRoute should have comment or be unexported (golint)
    • Line 336: warning: exported function PodInfoKey should have comment or be unexported (golint)
    • Line 394: warning: exported function NewIPNetWithMaxMask should have comment or be unexported (golint)
    • Line 407: warning: exported function IPNetToMaxMask should have comment or be unexported (golint)
    • Line 416: warning: exported function FindIPRules should have comment or be unexported (golint)
    • Line 440: warning: exported function EnsurePolicyRule should have comment or be unexported (golint)
    • Line 550: warning: exported function EnableIPv6 should have comment or be unexported (golint)
    • Line 562: warning: exported function GetHostIP should have comment or be unexported (golint)
    • Line 636: warning: exported function EnsureNeighbor should have comment or be unexported (golint)
    • terway/pkg/aliyun/credential/sts.go
    • Line 17: warning: exported type EncryptedCredentialInfo should have comment or be unexported (golint)
    • Line 25: warning: exported type EncryptedCredentialProvider should have comment or be unexported (golint)
    • Line 34: warning: exported method EncryptedCredentialProvider.Resolve should have comment or be unexported (golint)
    • Line 79: warning: exported method EncryptedCredentialProvider.Name should have comment or be unexported (golint)

license100%

Checks whether your project has a LICENSE file.

No problems detected. Good job!


ineffassign100%

IneffAssign detects ineffectual assignments in Go code.

No problems detected. Good job!


misspell100%

Misspell Finds commonly misspelled English words

No problems detected. Good job!