Re: [go-nuts] Re: Sorting an array of time.Duration

2017-05-03 Thread Michael Jones
Ram, Here is another example, a slightly modified version of ojucie's program: https://play.golang.org/p/uLsyW6oxz7 The difference here is to show the idea of making a custom type this is simply for the purpose of defining extra behaviors, such as those needed by Sort. On Tue, May 2, 2017 at

[go-nuts] Re: Sorting an array of time.Duration

2017-05-02 Thread ramachandrang
Thank you JuciÊ Andrade & Roberto. On Tuesday, May 2, 2017 at 12:07:19 PM UTC-7, JuciÊ Andrade wrote: > > From Go v1.8 onwards there is yet another alternative: you can use the > sort package without implementing the Sort interface. > > Example: > > https://play.golang.org/p/YmiWpshLlX > --

[go-nuts] Re: Sorting an array of time.Duration

2017-05-02 Thread ojucie
>From Go v1.8 onwards there is yet another alternative: you can use the sort package without implementing the Sort interface. Example: https://play.golang.org/p/YmiWpshLlX -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

[go-nuts] Re: Sorting an array of time.Duration

2017-05-02 Thread Roberto Zanotto
Seems to me that you didn't understand how to use sort, it's a bit different from what you are used to in other languages. Take a look at the examples in the package docs https://golang.org/pkg/sort/#example_ On Tuesday, May 2, 2017 at 8:16:20 PM UTC+2, ramach...@qualtrics.com wrote: > > Hello,