Skip to content

Commit

Permalink
Lint: fix deadcode issue
Browse files Browse the repository at this point in the history
Signed-off-by: Xiang Dai <long0dai@foxmail.com>
  • Loading branch information
daixiang0 committed May 22, 2020
1 parent f7c18e4 commit ada2020
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 80 deletions.
7 changes: 3 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,11 @@ issues:
linters:
- gomnd
- dupl
- path: pkg/apis/scheduling/v1beta1/conversion.go
linters:
- golint
- path: generated
- path: v1beta1
linters:
- golint
- deadcode
- path: fake
linters:
- golint
- deadcode
5 changes: 2 additions & 3 deletions pkg/apis/scheduling/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ import (
)

var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
localSchemeBuilder = &SchemeBuilder
AddToScheme = SchemeBuilder.AddToScheme
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)

// GroupName is the group name used in this package.
Expand Down
40 changes: 0 additions & 40 deletions pkg/scheduler/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,6 @@ import (
"volcano.sh/volcano/pkg/scheduler/util"
)

func nodesEqual(l, r map[string]*api.NodeInfo) bool {
if len(l) != len(r) {
return false
}

for k, n := range l {
if !reflect.DeepEqual(n, r[k]) {
return false
}
}

return true
}

func jobsEqual(l, r map[api.JobID]*api.JobInfo) bool {
if len(l) != len(r) {
return false
}

for k, p := range l {
if !reflect.DeepEqual(p, r[k]) {
return false
}
}

return true
}

func cacheEqual(l, r *SchedulerCache) bool {
return nodesEqual(l.Nodes, r.Nodes) &&
jobsEqual(l.Jobs, r.Jobs)
}

func buildNode(name string, alloc v1.ResourceList) *v1.Node {
return &v1.Node{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -111,13 +78,6 @@ func buildResourceList(cpu string, memory string) v1.ResourceList {
}
}

func buildResource(cpu string, memory string) *api.Resource {
return api.NewResource(v1.ResourceList{
v1.ResourceCPU: resource.MustParse(cpu),
v1.ResourceMemory: resource.MustParse(memory),
})
}

func buildOwnerReference(owner string) metav1.OwnerReference {
controller := true
return metav1.OwnerReference{
Expand Down
12 changes: 0 additions & 12 deletions pkg/scheduler/plugins/predicates/predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ limitations under the License.
package predicates

import (
"fmt"
"strings"

"k8s.io/klog"
"k8s.io/kubernetes/pkg/scheduler/algorithm"
"k8s.io/kubernetes/pkg/scheduler/algorithm/predicates"
Expand Down Expand Up @@ -56,15 +53,6 @@ func (pp *predicatesPlugin) Name() string {
return PluginName
}

func formatReason(reasons []predicates.PredicateFailureReason) string {
reasonStrings := []string{}
for _, v := range reasons {
reasonStrings = append(reasonStrings, fmt.Sprintf("%v", v.GetReason()))
}

return strings.Join(reasonStrings, ", ")
}

type predicateEnable struct {
memoryPressureEnable bool
diskPressureEnable bool
Expand Down
21 changes: 0 additions & 21 deletions test/e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -1082,27 +1082,6 @@ func IsNodeReady(node *v1.Node) bool {
return false
}

func waitClusterReady(ctx *context) error {
return wait.Poll(100*time.Millisecond, oneMinute, func() (bool, error) {
if readyNodeAmount(ctx) >= 1 {
return true, nil
}
return false, nil
})
}

func readyNodeAmount(ctx *context) int {
var amount int
nodes, err := ctx.kubeclient.CoreV1().Nodes().List(metav1.ListOptions{})
Expect(err).NotTo(HaveOccurred())
for _, n := range nodes.Items {
if IsNodeReady(&n) && len(n.Spec.Taints) == 0 {
amount++
}
}
return amount
}

func waitPodGone(ctx *context, podName, namespace string) error {
var additionalError error
err := wait.Poll(100*time.Millisecond, oneMinute, func() (bool, error) {
Expand Down

0 comments on commit ada2020

Please sign in to comment.