Re: [go-nuts] What is use for [:] of a slice?

2017-01-30 Thread Micky
[:] still has a use for arrays. https://play.golang.org/p/L0jfM46Zg4 On Tue, Jan 31, 2017 at 12:00 AM, Jan Mercl <0xj...@gmail.com> wrote: > On Mon, Jan 30, 2017 at 7:44 PM Andy Balholm > wrote: > > > Anyway, I can’t think of any reason to use [:] on a slice either. > > reasons[:]: https://play

Re: [go-nuts] What is use for [:] of a slice?

2017-01-30 Thread Jan Mercl
On Mon, Jan 30, 2017 at 7:44 PM Andy Balholm wrote: > Anyway, I can’t think of any reason to use [:] on a slice either. reasons[:]: https://play.golang.org/p/PN9qBf13Th ;-) -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

Re: [go-nuts] What is use for [:] of a slice?

2017-01-30 Thread Andy Balholm
Most likely they originally used an array, and changed it to a slice later. Since that line still compiled, it didn’t get changed. Or else they are just confused. Anyway, I can’t think of any reason to use [:] on a slice either. Andy -- You received this message because you are subscribed to

[go-nuts] What is use for [:] of a slice?

2017-01-30 Thread Tad Vizbaras
Slicing is useful but is there a difference between simple slice assignment and [:] ? Like this: A := []int{1, 2, 3} b := A[:] vs. b := A Why would I want to use A[:] if A is a slice? If A is an array I would understand. But it is a slice. I found this in some third party library and got puz