X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/754ff84aab18b623b37f21377c639694e6ea0ed7..3fa6aa4043286ad61e5f29c136d3cc2942e8750d:/sdk/go/keepclient/root_sorter.go diff --git a/sdk/go/keepclient/root_sorter.go b/sdk/go/keepclient/root_sorter.go index c2780bc716..c46b7185e6 100644 --- a/sdk/go/keepclient/root_sorter.go +++ b/sdk/go/keepclient/root_sorter.go @@ -1,3 +1,7 @@ +// Copyright (C) The Arvados Authors. All rights reserved. +// +// SPDX-License-Identifier: Apache-2.0 + package keepclient import ( @@ -5,12 +9,12 @@ import ( ) type RootSorter struct { - root []string - weight []string - order []int + root []string + weight []string + order []int } -func NewRootSorter(serviceRoots map[string]string, hash string) (*RootSorter) { +func NewRootSorter(serviceRoots map[string]string, hash string) *RootSorter { rs := new(RootSorter) rs.root = make([]string, len(serviceRoots)) rs.weight = make([]string, len(serviceRoots)) @@ -26,16 +30,15 @@ func NewRootSorter(serviceRoots map[string]string, hash string) (*RootSorter) { return rs } -func (rs RootSorter) getWeight(hash string, uuid string) (string) { +func (rs RootSorter) getWeight(hash string, uuid string) string { if len(uuid) == 27 { return Md5String(hash + uuid[12:]) - } else { - // Only useful for testing, a set of one service root, etc. - return Md5String(hash + uuid) } + // Only useful for testing, a set of one service root, etc. + return Md5String(hash + uuid) } -func (rs RootSorter) GetSortedRoots() ([]string) { +func (rs RootSorter) GetSortedRoots() []string { sorted := make([]string, len(rs.order)) for i := range rs.order { sorted[i] = rs.root[rs.order[i]]