Hello fellows
The following code (playground <https://play.golang.org/p/b9rMAK91Ns>) :

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

    //
    // 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[i] < itinerary[j]
    })

is broken for retrospectively obvious reasons.  Yet, I scratched my head 
for several minutes before finding the bug in my actual code.
So I wonder if this would be a good case for a new vet rule.  Something 
like "slicing the first argument is not a good idea, it will lead to 
something that is either broken or convoluted".
What do you think?

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