Hi I have the following code:
type Point struct { X int Name string } arr := []Point{ Point{1, "One"}, Point{3, "Three"}, Point{2, "Two"}, Point{4, "Four"}, } log.Println("Before Sorting: ", arr) sort.Slice(arr, func(i, j int) bool { return arr[i].X < arr[i].X }) log.Println("After Sorting: ", arr) I wanted to see the slice of Point objects to be sorted after I called the sort function, but the slice remains unchanged. The play url is: https://play.golang.org/p/9KHfyL0xzVP Any help on how I can get arr sorted in the above code ? Thanks. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.