Got it. I missed that the signature of the SortFunc does not include a return value. Thanks!
> On Sep 9, 2024, at 12:31 PM, Jan Mercl <0xj...@gmail.com> wrote: > > On Mon, Sep 9, 2024 at 9:24 PM P Padil <ppadil...@gmail.com> wrote: > >> Can someone please explain to me why the following doesn’t work: >> >> slices.SortFunc(ilps, func(u, w *big.Int) int { return u.Cmp(w) }) >> >> I get: >> slices.SortFunc(ilps, (func(u, w *big.Int) int literal)) (no value) used as >> value > > Providing a complete, self-contained, runnable code help others to help you. > > Without that I can only guess: you have used the non-value, as > indicated by the error message, as a RHS in an assignment. But its > signature shows it does not return any value: > https://pkg.go.dev/slices#SortFunc > > tl;dr: SortFunc sorts the underlying array of the argument slice but > it does not return the slice. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/7194EE88-E16C-46AE-B4E0-5E00E5B399C0%40gmail.com.