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 on pkg/controller and pkg/scheduler #3722

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xovoxy
Copy link

@xovoxy xovoxy commented Sep 13, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

fix staticcheck warnings on pkg/controllers and pkg/scheduler, warnings like this

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"

Which issue(s) this PR fixes:

Parts of #3713

Signed-off-by: xovoxy <xilovele@gmail.com>
Signed-off-by: xovoxy <xilovele@gmail.com>
@volcano-sh-bot volcano-sh-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 13, 2024
@volcano-sh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign hwdef
You can assign the PR to them by writing /assign @hwdef in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@volcano-sh-bot volcano-sh-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 13, 2024
@xovoxy
Copy link
Author

xovoxy commented Sep 13, 2024

hi @hwdef , this is the fix for the pkg/controller and pkg/scheduler sections
/assign @hwdef

Copy link
Member

@hwdef hwdef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/ok-to-test

@volcano-sh-bot volcano-sh-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. lgtm Indicates that a PR is ready to be merged. labels Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants