From 349afa60e135842672942bfa5e9a6ecff08b5938 Mon Sep 17 00:00:00 2001 From: ston1th Date: Wed, 10 Jun 2020 01:25:17 +0200 Subject: [PATCH] fixed typos --- node.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/node.go b/node.go index 7a8f89e..9e24db0 100644 --- a/node.go +++ b/node.go @@ -6,6 +6,7 @@ import ( "context" "errors" "fmt" + "sort" ) var ( @@ -71,13 +72,14 @@ func (nl *NodeList) getServerList(ctx context.Context, c *NodeClient) (err error return } } + return } type weightSorter NodeList func (s weightSorter) Len() int { return len(s) } func (s weightSorter) Less(i, j int) bool { - return s.weight() < s[j].weight() + return s[i].weight() < s[j].weight() } func (s weightSorter) Swap(i, j int) { s[i], s[j] = s[j], s[i] } @@ -107,7 +109,7 @@ func FilterNodeName(name string) NodeFilter { func FilterMaxCores(cores int64) NodeFilter { return func(nl *NodeList) { for i, n := range *nl { - if cores > n.MaxCPU { + if cores > int64(n.MaxCPU) { nl.remove(i) } } @@ -170,7 +172,7 @@ func (c *NodeClient) Schedule(ctx context.Context, filters ...NodeFilter) (n *No if err != nil { return } - nl.filter(filters) + nl.filter(filters...) nl.sortByWeight() if len(nl) == 0 { err = ErrUnschedulable