[go-nuts] Re: json: cannot unmarshal array into Go struct field data.Members of type main.Members

2018-10-09 Thread Frits van Bommel
Rename your "slug string" to "Slug string" to make it public so the json package can write to it, and make the "Members" field of data a slice: type Member struct { Slug string } type data struct { Members []Member } On Tuesday, October 9, 2018 at 2:46:02 PM UTC+2, pdbw...@gmail.com

Re: [go-nuts] Re: allowed imports for go appengine

2018-10-03 Thread Frits van Bommel
Actually, the standard environment *does* allow (outbound) sockets, but with some restrictions (and not via the "net" package). Also, it's still in Beta. The list of restrictions can be found here , and the API docs are here

[go-nuts] Re: When using 'go mod vendor' why are there lots of files missing?

2018-09-17 Thread Frits van Bommel
According to the help text that's the intended behavior: usage: go mod vendor [-v] > > Vendor resets the main module's vendor directory to include all packages > needed to build and test all the main module's packages. > It does not include test code for vendored packages. > > The -v flag causes

[go-nuts] Re: When should a RoundTripper close its connection?

2017-11-03 Thread Frits van Bommel
The best way is probably to replace the Response.Body before returning the result of http.ReadResponse() with an io.ReadCloser that also closes the underlying channel. Replace the end of RoundTrip() with something like this (untested) code: resp := http.ReadResponse(bufio.NewReader(ch),

Re: [go-nuts] Returning a JSON object saved as a string in a database

2017-08-12 Thread Frits van Bommel
On Friday, August 11, 2017 at 6:43:39 AM UTC+2, Dmitriy Cherchenko wrote: > > Just to make sure: When marshalling a struct, will fields of > type json.RawMessage be ignored (simply inserted into the JSON object > without further processing)? > There's some *slight* processing: - a check that

[go-nuts] Re: encoding/json: unexpected behaviour when unmarshalling into struct with interface{} field

2017-05-02 Thread Frits van Bommel
On Tuesday, May 2, 2017 at 10:53:36 PM UTC+2, Brian Stengaard wrote: > > > On Tuesday, 2 May 2017 16:02:47 UTC-4, Pierre Curto wrote: >> >> Hello, >> >> My guess: >> If you dont pass in a pointer, then you pass a value. >> What would be the point of updating the value that you will never see and

Re: [go-nuts] what is the best way to to convert c++ std::string to go string in cgo programing?

2017-04-20 Thread Frits van Bommel
ough with cgo to know if that's possible." (This is why replying to the mailing list is better, someone there might be more familiar with cgo) > 2017-04-19 16:40 GMT+08:00 Frits van Bommel <fvbom...@gmail.com>: > >> On Wednesday, April 19, 2017 at 9:10:16 AM UTC+2, hui zhang wrote:

Re: [go-nuts] what is the best way to to convert c++ std::string to go string in cgo programing?

2017-04-19 Thread Frits van Bommel
On Wednesday, April 19, 2017 at 9:10:16 AM UTC+2, hui zhang wrote: > > for 1) you mean >> >> char *CGetPath() { >> return getpath().c_str(); >> } > > > this code will work ? > That depends on whether getpath() returns a std::string or a (const) std::string& (a (const) reference). It will