Skip to content

Commit

Permalink
[Rajat] Refactor sort func
Browse files Browse the repository at this point in the history
  • Loading branch information
RajatVaryani committed Feb 11, 2019
1 parent 145aee1 commit a148b3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
5 changes: 1 addition & 4 deletions utility/sort/sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import (

func Procs(procList []metadata.Metadata) {
sort.Slice(procList, func(i, j int) bool {
if procList[i].Name < procList[j].Name {
return true
}
return false
return procList[i].Name < procList[j].Name
})
}
12 changes: 3 additions & 9 deletions utility/sort/sort_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,9 @@ import (
)

func TestSorting(t *testing.T) {
procOne := metadata.Metadata{
Name: "one"}

procTwo := metadata.Metadata{
Name: "two"}

procThree := metadata.Metadata{
Name: "three"}

procOne := metadata.Metadata{Name: "one"}
procTwo := metadata.Metadata{Name: "two"}
procThree := metadata.Metadata{Name: "three"}
procList := []metadata.Metadata{procThree, procTwo, procOne}
expectedProcList := []metadata.Metadata{procOne, procThree, procTwo}

Expand Down

0 comments on commit a148b3f

Please sign in to comment.