modify your code like this:
```go
package main

import (
"fmt"
"sort"
)

func main() {
//
// I am in Philadelphia, and I want to visit other cities
//
itinerary := []string{"Philadelphia", "Chicago", "Boston", "Austin", "Def"}

//
// I am in Philadelphia, and I want to visit other cities in alphabetical 
order
//
sort.Slice(itinerary[1:], func(i, j int) bool {
return itinerary[1:][i] < itinerary[1:][j]
})

fmt.Println("My new itinerary is", itinerary)
}
```
because you use itinerary[1:] to sort, but your sort function choosed 
itinerary's index to compare, so your result is not ok.

-- 
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.

Reply via email to