We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/golangci/golangci-lint/releases/tag/v1.21.0
I found static check issues when I ran make static-check against master with golangci-lint 1.21.0
make static-check
./scripts/lint-go.sh INFO [config_reader] Used config file scripts/golangci.yml INFO [lintersdb] Active 34 linters: [bodyclose deadcode depguard dogsled errcheck funlen gocognit goconst gocritic gocyclo godox gofmt goimports golint gosec gosimple govet ineffassign interfacer lll maligned misspell nakedret scopelint staticcheck structcheck stylecheck typecheck unconvert unparam unused varcheck whitespace wsl] INFO [loader] Go packages loading at mode 575 (imports|types_sizes|exports_file|files|name|compiled_files|deps) took 53.920041258s INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 8.833424ms INFO [runner/unused/goanalysis] analyzers took 1.72808947s with top 10 stages: buildssa: 1.593656839s, U1000: 134.432631ms WARN [runner] Can't run linter unused: buildssa: analysis skipped: errors in package: [/home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:878:43: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:883:54: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:888:71: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:892:42: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:792:56: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:797:36: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:598:49: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:645:36: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:655:56: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:660:49: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:550:57: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:554:49: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:532:50: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/utils.go:536:36: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/rbd.go:91:29: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/rbd.go:97:80: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/rbd.go:104:70: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/rbd.go:259:71: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/cephfs.go:81:29: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/cephfs.go:87:83: undeclared name: deployTimeout /home/mrajanna/workspace/src/github.com/ceph/ceph-csi/e2e/cephfs.go:94:73: undeclared name: deployTimeout] INFO [runner/goanalysis_metalinter/goanalysis] analyzers took 1m56.09530767s with top 10 stages: buildssa: 1m39.552718082s, inspect: 2.513967253s, ctrlflow: 1.191535287s, fact_purity: 1.115218426s, goimports: 1.085744096s, fact_deprecated: 1.041567752s, gocritic: 1.0384589s, printf: 1.011755546s, the_only_name: 673.780105ms, interfacer: 668.20001ms WARN [runner/nolint] Found unknown linters in //nolint directives: #nosec INFO [runner/max_same_issues] 111/114 issues with text "return statements should not be cuddled if block has more than two lines" were hidden, use --max-same-issues INFO [runner/max_same_issues] 104/107 issues with text "assignments should only be cuddled with other assignments" were hidden, use --max-same-issues INFO [runner/max_same_issues] 80/83 issues with text "only one cuddle assignment allowed before if statement" were hidden, use --max-same-issues INFO [runner/max_same_issues] 54/57 issues with text "if statements should only be cuddled with assignments" were hidden, use --max-same-issues INFO [runner/max_same_issues] 22/25 issues with text "only one cuddle assignment allowed before defer statement" were hidden, use --max-same-issues INFO [runner/max_same_issues] 20/23 issues with text "expressions should not be cuddled with blocks" were hidden, use --max-same-issues INFO [runner/max_same_issues] 14/17 issues with text "block should not start with a whitespace" were hidden, use --max-same-issues INFO [runner/max_same_issues] 11/14 issues with text "block should not end with a whitespace (or comment)" were hidden, use --max-same-issues INFO [runner/max_same_issues] 11/14 issues with text "declarations should never be cuddled" were hidden, use --max-same-issues INFO [runner/max_same_issues] 8/11 issues with text "unnecessary trailing newline" were hidden, use --max-same-issues INFO [runner/max_same_issues] 5/8 issues with text "only one cuddle assignment allowed before range statement" were hidden, use --max-same-issues INFO [runner/max_same_issues] 4/7 issues with text "only cuddled expressions if assigning variable or using from line above" were hidden, use --max-same-issues INFO [runner/max_same_issues] 3/6 issues with text "if statements should only be cuddled with assignments used in the if statement itself" were hidden, use --max-same-issues INFO [runner/max_same_issues] 2/5 issues with text "ranges should only be cuddled with assignments used in the iteration" were hidden, use --max-same-issues INFO [runner] Issues before processing: 693, after processing: 89 INFO [runner] Processors filtering stat (out/in): max_per_file_from_linter: 538/538, max_same_issues: 89/538, autogenerated_exclude: 693/693, diff: 538/538, source_code: 89/89, path_shortener: 89/89, identifier_marker: 693/693, nolint: 559/569, uniq_by_line: 538/559, cgo: 693/693, filename_unadjuster: 693/693, path_prettifier: 693/693, skip_files: 693/693, skip_dirs: 693/693, exclude: 569/693, exclude-rules: 569/569, max_from_linter: 89/89 INFO [runner] processing took 159.342362ms with stages: exclude: 78.868934ms, identifier_marker: 45.241461ms, nolint: 16.936872ms, path_prettifier: 14.165748ms, autogenerated_exclude: 1.99753ms, source_code: 723.547µs, skip_dirs: 648.292µs, cgo: 219.699µs, filename_unadjuster: 200.671µs, max_same_issues: 189.604µs, uniq_by_line: 97.392µs, max_per_file_from_linter: 24.182µs, path_shortener: 17.774µs, max_from_linter: 9.219µs, skip_files: 774ns, diff: 380ns, exclude-rules: 283ns INFO [runner] linters took 36.389759967s with stages: goanalysis_metalinter: 34.171486658s, unused: 2.058822536s pkg/util/voljournal.go:249: pkg/util/voljournal.go:249: Line contains TODO/BUG/FIXME: "TODO: Check cases where volName can be e..." (godox) // TODO: Check cases where volName can be empty, and we need to just cleanup the reqName pkg/util/voljournal.go:386: pkg/util/voljournal.go:386: Line contains TODO/BUG/FIXME: "TODO: fetch all omap vals in one call, t..." (godox) // TODO: fetch all omap vals in one call, than make multiple listomapvals pkg/util/volid_test.go:32: pkg/util/volid_test.go:32: Line contains TODO/BUG/FIXME: "TODO: Add more test tuples to test out o..." (godox) // TODO: Add more test tuples to test out other edge conditions pkg/csi-common/driver.go:50: pkg/csi-common/driver.go:50: Line contains TODO/BUG/FIXME: "TODO version format and validation" (godox) // TODO version format and validation pkg/csi-common/nodeserver-default.go:91: pkg/csi-common/nodeserver-default.go:94: Line contains TODO/BUG/FIXME: "TODO: Map the volumeID to the targetpath..." (godox) /* pkg/rbd/controllerserver.go:78: pkg/rbd/controllerserver.go:78: Line contains TODO/BUG/FIXME: "TODO (sbezverk) Last check for not excee..." (godox) // TODO (sbezverk) Last check for not exceeding total storage capacity pkg/rbd/controllerserver.go:283: pkg/rbd/controllerserver.go:283: Line contains TODO/BUG/FIXME: "TODO: can we detect "already deleted" si..." (godox) // TODO: can we detect "already deleted" situations here and proceed? pkg/rbd/nodeserver.go:331: pkg/rbd/nodeserver.go:331: Line contains TODO/BUG/FIXME: "TODO: update this when adding support fo..." (godox) // TODO: update this when adding support for static (pre-provisioned) PVs pkg/rbd/rbd_journal.go:195: pkg/rbd/rbd_journal.go:195: Line contains TODO/BUG/FIXME: "TODO: We should also ensure image featur..." (godox) // TODO: We should also ensure image features and format is the same pkg/cephfs/cephuser.go:41: pkg/cephfs/cephuser.go:41: Line contains TODO/BUG/FIXME: "TODO: Need to return success if userID i..." (godox) // TODO: Need to return success if userID is not found pkg/cephfs/controllerserver.go:96: pkg/cephfs/controllerserver.go:96: Line contains TODO/BUG/FIXME: "TODO need to add check for 0 volume size" (godox) // TODO need to add check for 0 volume size pkg/cephfs/controllerserver.go:103: pkg/cephfs/controllerserver.go:103: Line contains TODO/BUG/FIXME: "TODO return error message if requested v..." (godox) // TODO return error message if requested vol size greater than found volume return error pkg/cephfs/fsjournal.go:70: pkg/cephfs/fsjournal.go:70: Line contains TODO/BUG/FIXME: "TODO: size checks" (godox) // TODO: size checks pkg/cephfs/volume.go:78: pkg/cephfs/volume.go:78: Line contains TODO/BUG/FIXME: "TODO: When we support multiple fs, need ..." (godox) //TODO: When we support multiple fs, need to hande subvolume group create for all fs's e2e/cephfs.go:139: e2e/cephfs.go:139: Line contains TODO/BUG/FIXME: "TODO add cephfs backend validation" (godox) // TODO add cephfs backend validation e2e/utils.go:115: e2e/utils.go:115: Line contains TODO/BUG/FIXME: "TODO need to check rolling update" (godox) // TODO need to check rolling update pkg/cephfs/volumemounter.go:70:1: cognitive complexity 34 of func `kernelSupportsQuota` is high (> 30) (gocognit) func kernelSupportsQuota(release string) bool { ^ pkg/util/csiconfig_test.go:36: Function 'TestCSIConfig' has too many statements (55 > 40) (funlen) func TestCSIConfig(t *testing.T) { pkg/csi-common/nodeserver-default.go:83: Function 'NodeGetVolumeStats' is too long (91 > 60) (funlen) func (ns *DefaultNodeServer) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error) { pkg/csi-common/server.go:79: Function 'serve' has too many statements (43 > 40) (funlen) func (s *nonBlockingGRPCServer) serve(endpoint, hstOptions string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer, metrics bool) { pkg/rbd/controllerserver.go:120: Function 'CreateVolume' is too long (66 > 60) (funlen) func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) { pkg/rbd/controllerserver.go:297: Function 'DeleteVolume' has too many statements (44 > 40) (funlen) func (cs *ControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) { pkg/rbd/controllerserver.go:413: Function 'CreateSnapshot' has too many statements (42 > 40) (funlen) func (cs *ControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) { pkg/rbd/controllerserver.go:568: Function 'DeleteSnapshot' is too long (76 > 60) (funlen) func (cs *ControllerServer) DeleteSnapshot(ctx context.Context, req *csi.DeleteSnapshotRequest) (*csi.DeleteSnapshotResponse, error) { pkg/rbd/driver.go:91: Function 'Run' is too long (67 > 60) (funlen) func (r *Driver) Run(conf *util.Config, cachePersister util.CachePersister) { pkg/rbd/nodeserver.go:58: Function 'NodeStageVolume' has too many statements (64 > 40) (funlen) func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) { pkg/rbd/nodeserver.go:460: Function 'NodeUnstageVolume' has too many statements (41 > 40) (funlen) func (ns *NodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) { pkg/cephfs/controllerserver.go:70: Function 'CreateVolume' is too long (75 > 60) (funlen) func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error) { pkg/cephfs/controllerserver.go:150: Function 'deleteVolumeDeprecated' is too long (61 > 60) (funlen) func (cs *ControllerServer) deleteVolumeDeprecated(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) { pkg/cephfs/driver.go:93: Function 'Run' is too long (72 > 60) (funlen) func (fs *Driver) Run(conf *util.Config, cachePersister util.CachePersister) { pkg/cephfs/mountcache.go:104: Function 'mountOneCacheEntry' is too long (65 > 60) (funlen) func mountOneCacheEntry(volOptions *volumeOptions, vid *volumeIdentifier, me *volumeMountCacheEntry) error { pkg/cephfs/nodeserver.go:69: Function 'NodeStageVolume' is too long (62 > 60) (funlen) func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) { pkg/cephfs/nodeserver.go:165: Function 'NodePublishVolume' has too many statements (42 > 40) (funlen) func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) { pkg/cephfs/volumeoptions.go:185: Function 'newVolumeOptionsFromVolID' is too long (70 > 60) (funlen) func newVolumeOptionsFromVolID(ctx context.Context, volID string, volOpt, secrets map[string]string) (*volumeOptions, *volumeIdentifier, error) { cmd/cephcsi.go:107: Function 'main' has too many statements (47 > 40) (funlen) func main() { e2e/utils.go:590: Function 'validateNormalUserPVCAccess' is too long (73 > 60) (funlen) func validateNormalUserPVCAccess(pvcPath string, f *framework.Framework) { pkg/util/cachepersister.go:46:3: assignments should only be cuddled with other assignments (wsl) k8scm := &K8sCMCache{} ^ pkg/util/cachepersister.go:49:3: return statements should not be cuddled if block has more than two lines (wsl) return k8scm, nil ^ pkg/util/cachepersister.go:57:2: return statements should not be cuddled if block has more than two lines (wsl) return nil, errors.New("cache-persister: couldn't parse metadatastorage flag") ^ pkg/util/cephcmds.go:59:104: block should not start with a whitespace (wsl) func getPools(ctx context.Context, monitors string, cr *Credentials) ([]cephStoragePoolSummary, error) { ^ pkg/util/cephcmds.go:78:2: only one cuddle assignment allowed before if statement (wsl) if err != nil { ^ pkg/util/cephcmds.go:194:2: return statements should not be cuddled if block has more than two lines (wsl) return string(keyValue), err ^ pkg/util/cephcmds.go:244:3: if statements should only be cuddled with assignments (wsl) if strings.Contains(string(stderr), "error creating "+poolName+"/"+objectName+ ^ pkg/util/cephcmds.go:274:3: if statements should only be cuddled with assignments (wsl) if strings.Contains(string(stderr), "error removing "+poolName+">"+oMapName+ ^ pkg/util/credentials.go:46:2: only one cuddle assignment allowed before defer statement (wsl) defer func() { ^ pkg/util/credentials.go:79:2: if statements should only be cuddled with assignments (wsl) if c.ID, ok = secrets[idField]; !ok { ^ pkg/util/credentials.go:114:2: only one cuddle assignment allowed before if statement (wsl) if err == nil { ^ pkg/util/httpserver.go:24:2: only one cuddle assignment allowed before if statement (wsl) if err != nil { ^ pkg/util/idlocker.go:52:2: expressions should not be cuddled with blocks (wsl) vl.locks.Insert(volumeID) ^ pkg/util/k8scmcache.go:64:2: declarations should never be cuddled (wsl) var err error ^ pkg/util/k8scmcache.go:65:2: assignments should only be cuddled with other assignments (wsl) cPath := os.Getenv("KUBERNETES_CONFIG_PATH") ^ pkg/util/k8scmcache.go:79:2: assignments should only be cuddled with other assignments (wsl) client, err := k8s.NewForConfig(cfg) ^ pkg/util/k8scmcache.go:186:2: expressions should not be cuddled with blocks (wsl) klog.V(4).Infof("k8s-cm-cache: successfully deleted metadata configmap %s", identifier) ^ pkg/util/nodecache.go:74:2: block should not end with a whitespace (or comment) (wsl) } ^ pkg/util/nodecache.go:63:2: only one cuddle assignment allowed before range statement (wsl) for _, file := range files { ^ pkg/util/nodecache.go:102:1: block should not end with a whitespace (or comment) (wsl) } ^ pkg/util/nodecache.go:97:3: block should not end with a whitespace (or comment) (wsl) } ^ pkg/util/nodecache.go:122:2: expressions should not be cuddled with blocks (wsl) klog.V(4).Infof("node-cache: successfully saved metadata into file: %s\n", file) ^ pkg/util/pidlimit.go:47:2: declarations should never be cuddled (wsl) var slice string ^ pkg/util/pidlimit.go:48:2: only one cuddle assignment allowed before for statement (wsl) for scanner.Scan() { ^ pkg/util/util.go:140:2: declarations should never be cuddled (wsl) var err error ^ pkg/util/util.go:141:2: only one cuddle assignment allowed before range statement (wsl) for _, msg := range validation.IsDNS1123Subdomain(strings.ToLower(driverName)) { ^ pkg/util/voljournal.go:289:5: branch statements should not be cuddled if block has more than two lines (wsl) continue ^ pkg/util/voljournal.go:278:2: only one cuddle assignment allowed before for statement (wsl) for attempt <= maxAttempts { ^ pkg/util/voljournal.go:341:2: only one cuddle assignment allowed before defer statement (wsl) defer func() { ^ pkg/util/util_test.go:74:2: only one cuddle assignment allowed before range statement (wsl) for _, tt := range tests { ^ pkg/liveness/liveness.go:40:67: block should not start with a whitespace (wsl) func getLiveness(timeout time.Duration, csiConn *grpc.ClientConn) { ^ pkg/csi-common/driver.go:97:2: ranges should only be cuddled with assignments used in the iteration (wsl) for _, c := range vc { ^ pkg/csi-common/server.go:58:150: block should not start with a whitespace (wsl) func (s *nonBlockingGRPCServer) Start(endpoint, hstOptions string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer, metrics bool) { ^ pkg/csi-common/server.go:61:2: go statements can only invoke functions assigned on line above (wsl) go s.serve(endpoint, hstOptions, ids, cs, ns, metrics) ^ pkg/rbd/controllerserver.go:130:2: only one cuddle assignment allowed before defer statement (wsl) defer cr.DeleteCredentials() ^ pkg/rbd/controllerserver.go:528:2: defer statements should only be cuddled with expressions on same variable (wsl) defer func() { ^ pkg/rbd/nodeserver.go:177:2: if statements should only be cuddled with assignments used in the if statement itself (wsl) if isMounted { ^ pkg/rbd/nodeserver.go:372:2: append only allowed to cuddle with appended value (wsl) mountFlags = append(mountFlags, "bind") ^ pkg/rbd/rbd_attach.go:214:2: if statements should only be cuddled with assignments used in the if statement itself (wsl) if volOpt.Mounter == rbdTonbd && hasNBD { ^ pkg/rbd/rbd_util.go:413:2: if statements should only be cuddled with assignments used in the if statement itself (wsl) if options != nil { ^ pkg/cephfs/controllerserver.go:58:2: defer statements should only be cuddled with expressions on same variable (wsl) defer func() { ^ pkg/cephfs/mountcache.go:142:3: only cuddled expressions if assigning variable or using from line above (wsl) klog.Infof("mount-cache: failed to check volume mounted %s: %s %v", volID, me.StagingPath, err) ^ pkg/cephfs/mountcache.go:158:2: ranges should only be cuddled with assignments used in the iteration (wsl) for targetPath, readOnly := range me.TargetPaths { ^ pkg/cephfs/mountcache.go:192:2: type switch statements should only be cuddled with variables switched (wsl) switch pe := err.(type) { ^ pkg/cephfs/mountcache.go:240:3: only cuddled expressions if assigning variable or using from line above (wsl) klog.Warningf(util.Log(ctx, "mount-cache: node stage volume ignore last cache entry for volume %s"), volID) ^ pkg/cephfs/mountcache.go:306:2: ranges should only be cuddled with assignments used in the iteration (wsl) for key, value := range input { ^ pkg/cephfs/volumemounter.go:291:2: append only allowed to cuddle with appended value (wsl) args = append(args, "-o", optionsStr) ^ cmd/cephcsi.go:173:2: switch statements should only be cuddled with variables switched (wsl) switch conf.Vtype { ^ e2e/utils.go:74:2: only cuddled expressions if assigning variable or using from line above (wsl) e2elog.Logf("Waiting up to %v for all daemonsets in namespace '%s' to start", ^ e2e/utils.go:409:2: expressions should not be cuddled with declarations or returns (wsl) e2elog.Logf("Deleting PersistentVolumeClaim %v on namespace %v", name, nameSpace) ^ pkg/util/nodecache.go:73: unnecessary trailing newline (whitespace) } pkg/util/nodecache.go:101: unnecessary trailing newline (whitespace) } pkg/util/nodecache.go:96: unnecessary trailing newline (whitespace) } INFO File cache stats: 93 entries of total size 587.4KiB INFO Memory: 796 samples, avg is 295.7MB, max is 1016.7MB INFO Execution took 1m30.327804755s make: *** [Makefile:45: static-check] Error 1
The text was updated successfully, but these errors were encountered:
I always wonder why this error occurred in my laptop. 👍
Sorry, something went wrong.
@WoohyungHan would you like to solve this ? :)
@humblec it's my pleasure :>
@WoohyungHan then go for it.. @Madhu-1 any other thought ?
Assigned to @WoohyungHan
woohhan
Successfully merging a pull request may close this issue.
https://github.com/golangci/golangci-lint/releases/tag/v1.21.0
I found static check issues when I ran
make static-check
against master with golangci-lint 1.21.0The text was updated successfully, but these errors were encountered: