[go-nuts] Re: Date parsing problem

2017-03-14 Thread db047h
May be non-printable garbage at the beginning of "06/11/2014"? When the error occurs, dump the problematic date as a []byte slice and see what it spits out. On Tuesday, March 14, 2017 at 1:13:57 PM UTC+1, mbanzon wrote: > > Hey gophers! > > I'm having some trouble parsing a few dates and I'm thi

Re: [go-nuts] Slice from interface doesn't work as expected

2017-03-14 Thread db047h
Internally, a slice variable is a SliceHeader struct (see https://golang.org/pkg/reflect/#SliceHeader), NOT a pointer to it. Note that len and cap are properties of the SliceHeader struct, NOT of the backing array. So yes, I made a mistake, the x slice header is copied into z at every iteratio

Re: [go-nuts] Slice from interface doesn't work as expected

2017-03-05 Thread db047h
This happens only because z is copied every time, but has nothing to do with interfaces. This exhibits the same behavior without interface{}: https://play.golang.org/p/C5KoUST4Zn You could in fact modify the slice's existing content, but not the slice itself. For example: x := make([]int, 1, 5

Re: [go-nuts] Writing safe CGO calls and callbacks and how that affects system threads

2017-02-13 Thread db047h
On Monday, February 13, 2017 at 7:02:22 AM UTC+1, Luka Napotnik wrote: > > I forgot to mention that the main goroutine in the test program is locked > to a thread as I call runtime.LockOSThread() in init() The Go Spec says "Package initializa