Skip to content
New issue

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

fix staticcheck warnings #3713

Open
hwdef opened this issue Sep 10, 2024 · 3 comments
Open

fix staticcheck warnings #3713

hwdef opened this issue Sep 10, 2024 · 3 comments
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.

Comments

@hwdef
Copy link
Member

hwdef commented Sep 10, 2024

What is the problem you're trying to solve

fix staticchcek warnings in volcano reop

cmd/controller-manager/app/server.go:84:9: opt.LockObjectNamespace is deprecated: use ResourceNamespace instead.  (SA1019)
cmd/controller-manager/app/server.go:85:42: opt.LockObjectNamespace is deprecated: use ResourceNamespace instead.  (SA1019)
cmd/scheduler/app/server.go:117:9: opt.LockObjectNamespace is deprecated: use ResourceNamespace instead.  (SA1019)
cmd/scheduler/app/server.go:118:42: opt.LockObjectNamespace is deprecated: use ResourceNamespace instead.  (SA1019)
cmd/webhook-manager/app/util.go:49:13: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
cmd/webhook-manager/app/util.go:82:13: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
example/extender/extender.go:28:5: var snapshot is unused (U1000)
pkg/controllers/garbagecollector/garbagecollector.go:24:2: package "k8s.io/apimachinery/pkg/api/errors" is being imported more than once (ST1019)
	pkg/controllers/garbagecollector/garbagecollector.go:25:2: other import of "k8s.io/apimachinery/pkg/api/errors"
pkg/controllers/job/job_controller_actions.go:29:2: package "k8s.io/apimachinery/pkg/api/errors" is being imported more than once (ST1019)
	pkg/controllers/job/job_controller_actions.go:30:2: other import of "k8s.io/apimachinery/pkg/api/errors"
pkg/controllers/job/job_controller_util_test.go:27:2: package "volcano.sh/apis/pkg/apis/batch/v1alpha1" is being imported more than once (ST1019)
	pkg/controllers/job/job_controller_util_test.go:28:2: other import of "volcano.sh/apis/pkg/apis/batch/v1alpha1"
pkg/controllers/jobflow/jobflow_controller.go:42:2: package "volcano.sh/volcano/pkg/controllers/jobflow/state" is being imported more than once (ST1019)
	pkg/controllers/jobflow/jobflow_controller.go:43:2: other import of "volcano.sh/volcano/pkg/controllers/jobflow/state"
pkg/scheduler/api/devices/nvidia/gpushare/share.go:214:9: should omit nil check; len() for map[string]*k8s.io/api/core/v1.Pod is defined as zero (S1009)
pkg/scheduler/api/unschedule_info_test.go:98:12: printf-style function with dynamic format string and no further arguments should use print-style function instead (SA1006)
pkg/scheduler/api/unschedule_info_test.go:106:12: printf-style function with dynamic format string and no further arguments should use print-style function instead (SA1006)
pkg/scheduler/cache/cache.go:176:8: sets.String is deprecated: use generic Set instead. new ways: s1 := Set[string]{} s2 := New[string]()  (SA1019)
pkg/scheduler/cache/cache.go:377:15: printf-style function with dynamic format string and no further arguments should use print-style function instead (SA1006)
pkg/scheduler/metrics/source/metrics_client.go:55:15: error strings should not be capitalized (ST1005)
pkg/scheduler/metrics/source/metrics_client.go:55:15: error strings should not end with punctuation or newlines (ST1005)
pkg/scheduler/plugins/drf/hdrf_test.go:40:6: type queueSpec is unused (U1000)
pkg/scheduler/plugins/drf/hdrf_test.go:46:6: type pgSpec is unused (U1000)
pkg/scheduler/plugins/predicates/predicates.go:349:11: error strings should not be capitalized (ST1005)
pkg/scheduler/plugins/proportion/proportion_test.go:216:5: should use a simple channel send/receive instead of select with a single case (S1000)
pkg/scheduler/plugins/proportion/proportion_test.go:277:3: should use for range instead of for { select {} } (S1000)
pkg/scheduler/plugins/util/k8s/snapshot_test.go:128:4: this value of err is never used (SA4006)
pkg/scheduler/uthelper/helper.go:172:11: error strings should not be capitalized (ST1005)
pkg/scheduler/uthelper/helper.go:172:11: error strings should not end with punctuation or newlines (ST1005)
pkg/scheduler/uthelper/helper.go:206:11: error strings should not be capitalized (ST1005)
pkg/scheduler/uthelper/helper.go:206:11: error strings should not end with punctuation or newlines (ST1005)
pkg/webhooks/admission/jobs/validate/admit_job.go:39:2: package "volcano.sh/volcano/pkg/controllers/job/helpers" is being imported more than once (ST1019)
	pkg/webhooks/admission/jobs/validate/admit_job.go:40:2: other import of "volcano.sh/volcano/pkg/controllers/job/helpers"
test/e2e/jobp/admission.go:27:2: package "k8s.io/apimachinery/pkg/apis/meta/v1" is being imported more than once (ST1019)
	test/e2e/jobp/admission.go:28:2: other import of "k8s.io/apimachinery/pkg/apis/meta/v1"
test/e2e/jobp/admission.go:31:2: package "volcano.sh/apis/pkg/apis/scheduling/v1beta1" is being imported more than once (ST1019)
	test/e2e/jobp/admission.go:32:2: other import of "volcano.sh/apis/pkg/apis/scheduling/v1beta1"
test/e2e/jobp/job_controlled_resource.go:22:2: should not use dot imports (ST1001)
test/e2e/jobp/job_controlled_resource.go:23:2: should not use dot imports (ST1001)
test/e2e/jobp/job_lifecycle.go:22:2: should not use dot imports (ST1001)
test/e2e/jobp/job_lifecycle.go:23:2: should not use dot imports (ST1001)
test/e2e/jobp/job_restart.go:22:2: should not use dot imports (ST1001)
test/e2e/jobp/job_restart.go:23:2: should not use dot imports (ST1001)
test/e2e/jobp/job_scale_up_down.go:23:2: should not use dot imports (ST1001)
test/e2e/jobp/job_scale_up_down.go:24:2: should not use dot imports (ST1001)
test/e2e/jobp/min_success.go:20:2: should not use dot imports (ST1001)
test/e2e/jobp/min_success.go:21:2: should not use dot imports (ST1001)
test/e2e/jobp/pg_controller.go:22:2: should not use dot imports (ST1001)
test/e2e/jobp/pg_controller.go:23:2: should not use dot imports (ST1001)
test/e2e/jobseq/job_error_handling.go:23:2: should not use dot imports (ST1001)
test/e2e/jobseq/job_error_handling.go:24:2: should not use dot imports (ST1001)
test/e2e/jobseq/job_plugins.go:24:2: should not use dot imports (ST1001)
test/e2e/jobseq/job_plugins.go:25:2: should not use dot imports (ST1001)
test/e2e/jobseq/mpi.go:20:2: should not use dot imports (ST1001)
test/e2e/jobseq/mpi.go:21:2: should not use dot imports (ST1001)
test/e2e/jobseq/mpi_plugin.go:20:2: should not use dot imports (ST1001)
test/e2e/jobseq/mpi_plugin.go:21:2: should not use dot imports (ST1001)
test/e2e/jobseq/pytorch_plugin.go:4:2: should not use dot imports (ST1001)
test/e2e/jobseq/pytorch_plugin.go:5:2: should not use dot imports (ST1001)
test/e2e/jobseq/queue.go:21:2: should not use dot imports (ST1001)
test/e2e/jobseq/queue.go:22:2: should not use dot imports (ST1001)
test/e2e/jobseq/queue_job_status.go:24:2: should not use dot imports (ST1001)
test/e2e/jobseq/queue_job_status.go:25:2: should not use dot imports (ST1001)
test/e2e/jobseq/queue_job_status.go:47:11: error strings should not be capitalized (ST1005)
test/e2e/jobseq/queue_job_status.go:103:11: error strings should not be capitalized (ST1005)
test/e2e/jobseq/queue_job_status.go:135:3: this value of err is never used (SA4006)
test/e2e/jobseq/queue_job_status.go:169:11: error strings should not be capitalized (ST1005)
test/e2e/jobseq/queue_job_status.go:204:3: this value of err is never used (SA4006)
test/e2e/jobseq/tensorflow.go:22:2: should not use dot imports (ST1001)
test/e2e/jobseq/tensorflow.go:23:2: should not use dot imports (ST1001)
test/e2e/jobseq/tensorflow_plugin.go:22:2: should not use dot imports (ST1001)
test/e2e/jobseq/tensorflow_plugin.go:23:2: should not use dot imports (ST1001)
test/e2e/schedulingaction/predicates.go:20:2: should not use dot imports (ST1001)
test/e2e/schedulingaction/predicates.go:21:2: should not use dot imports (ST1001)
test/e2e/schedulingaction/preempt.go:23:2: should not use dot imports (ST1001)
test/e2e/schedulingaction/preempt.go:24:2: should not use dot imports (ST1001)
test/e2e/schedulingaction/reclaim.go:24:2: should not use dot imports (ST1001)
test/e2e/schedulingaction/reclaim.go:25:2: should not use dot imports (ST1001)
test/e2e/schedulingbase/drf.go:20:2: should not use dot imports (ST1001)
test/e2e/schedulingbase/drf.go:21:2: should not use dot imports (ST1001)
test/e2e/schedulingbase/job_scheduling.go:25:2: should not use dot imports (ST1001)
test/e2e/schedulingbase/job_scheduling.go:26:2: should not use dot imports (ST1001)
test/e2e/schedulingbase/job_scheduling.go:502:6: x % 1 is always zero (SA4028)
test/e2e/schedulingbase/job_scheduling.go:505:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/schedulingbase/job_scheduling.go:561:3: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/schedulingbase/job_scheduling.go:584:3: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/schedulingbase/sla.go:22:2: should not use dot imports (ST1001)
test/e2e/schedulingbase/sla.go:23:2: should not use dot imports (ST1001)
test/e2e/util/configmap.go:73:12: should use time.Since instead of time.Now().Sub (S1012)
test/e2e/util/deployment.go:23:2: should not use dot imports (ST1001)
test/e2e/util/deployment.go:103:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/deployment.go:181:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/job.go:27:2: should not use dot imports (ST1001)
test/e2e/util/job.go:276:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/job.go:309:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/job.go:346:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/job.go:533:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/job.go:558:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/job.go:577:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/job.go:643:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/job.go:700:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/job.go:717:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/job.go:741:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/job.go:775:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/node.go:24:2: should not use dot imports (ST1001)
test/e2e/util/podgroup.go:25:2: should not use dot imports (ST1001)
test/e2e/util/podgroup.go:59:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/queue.go:23:2: should not use dot imports (ST1001)
test/e2e/util/queue.go:24:2: should not use dot imports (ST1001)
test/e2e/util/queue.go:108:8: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/queue.go:149:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/replicaset.go:23:2: should not use dot imports (ST1001)
test/e2e/util/replicaset.go:98:9: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/util/util.go:28:2: should not use dot imports (ST1001)
test/e2e/util/util.go:29:2: should not use dot imports (ST1001)
test/e2e/util/util.go:31:2: package "k8s.io/api/core/v1" is being imported more than once (ST1019)
	test/e2e/util/util.go:32:2: other import of "k8s.io/api/core/v1"
test/e2e/util/util.go:217:8: wait.Poll is deprecated: This method does not return errors from context, use PollUntilContextTimeout. Note that the new method will no longer return ErrWaitTimeout and instead return errors defined by the context package. Will be removed in a future release.  (SA1019)
test/e2e/vcctl/cli_util.go:24:2: should not use dot imports (ST1001)
test/e2e/vcctl/command.go:24:2: should not use dot imports (ST1001)
test/e2e/vcctl/command.go:25:2: should not use dot imports (ST1001)
test/e2e/vcctl/vcctl.go:23:2: should not use dot imports (ST1001)
test/e2e/vcctl/vcctl.go:24:2: should not use dot imports (ST1001)

Describe the solution you'd like

Create a commit to fix staticcheck warnings based on the folder level

Additional context

How to check staticcheck:

cd volcano && staticchcek ./...
@hwdef hwdef added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 10, 2024
@hwdef
Copy link
Member Author

hwdef commented Sep 10, 2024

/good-first-issue

@volcano-sh-bot
Copy link
Contributor

@hwdef:
This request has been marked as suitable for new contributors.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-good-first-issue command.

In response to this:

/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@volcano-sh-bot volcano-sh-bot added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Sep 10, 2024
@xovoxy
Copy link

xovoxy commented Sep 11, 2024

hi @hwdef, i am interested in working on this issue~
/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants