https://codereview.appspot.com/100810045/diff/40001/state/api/apiclient.go File state/api/apiclient.go (right):
https://codereview.appspot.com/100810045/diff/40001/state/api/apiclient.go#newcode111 state/api/apiclient.go:111: We should use the built-in sort here.
http://golang.org/pkg/sort/
type LocalhostFirst []string
func (a LocalhostFirst) Len() int { return len(a) } func (a LocalhostFirst) Swap(i int, j int) { a[i], a[j] = a[j], a[i] } func (a LocalhostFirst) Less(i int, j int) bool { return strings.HasPrefix(a[i], "localhost") }
return sort.Sort(LocalhostFirst(addrs))
https://codereview.appspot.com/100810045/
« Back to merge proposal
https:/ /codereview. appspot. com/100810045/ diff/40001/ state/api/ apiclient. go apiclient. go (right):
File state/api/
https:/ /codereview. appspot. com/100810045/ diff/40001/ state/api/ apiclient. go#newcode111 apiclient. go:111:
state/api/
We should use the built-in sort here.
http:// golang. org/pkg/ sort/
type LocalhostFirst []string
func (a LocalhostFirst) Len() int { return len(a) } HasPrefix( a[i], "localhost") }
func (a LocalhostFirst) Swap(i int, j int) { a[i], a[j] = a[j], a[i] }
func (a LocalhostFirst) Less(i int, j int) bool { return
strings.
return sort.Sort( LocalhostFirst( addrs))
https:/ /codereview. appspot. com/100810045/