Re: [go-nuts] custom json unmarshaling between object or arrays

2016-12-28 Thread Sathish VJ
aah, got it. the case []interface{}: is what I'd not gotten right. Thanks for the detailed examples. On Thursday, 29 December 2016 12:57:54 UTC+5:30, Konstantin Khomoutov wrote: > > On Wed, 28 Dec 2016 21:55:33 -0800 (PST) > Sathish VJ wrote: > > > I'm trying to do

[go-nuts] concurrent sqlite database access... how to handle?

2016-12-28 Thread Val
Hello Eric You may use a map[string]*sync.Mutex where key is the DB filepath, and protect that map with a global mutex. Note that a mutex value must not be copied, often it is necessary to use pointers. -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] custom json unmarshaling between object or arrays

2016-12-28 Thread Konstantin Khomoutov
On Wed, 28 Dec 2016 21:55:33 -0800 (PST) Sathish VJ wrote: > I'm trying to do custom json unmarshaling when there could be an > error. > > In case there is an error, it will have json like: { "error": "err > msg"} Else, it could be anything. > > If it is another json

Re: [go-nuts] Re: How to use ~/ in terminal with go program?

2016-12-28 Thread Aurélien DESBRIÈRES
That sounds good. I will try it and tell you back. Thanks On Thu, Dec 29, 2016, 5:02 AM Caleb Doxsey wrote: > You can use this library: > https://godoc.org/github.com/mitchellh/go-homedir#Expand > > > On Wednesday, December 28, 2016 at 8:22:06 AM UTC-5, Aurélien Desbrières >

[go-nuts] custom json unmarshaling between object or arrays

2016-12-28 Thread Sathish VJ
I'm trying to do custom json unmarshaling when there could be an error. In case there is an error, it will have json like: { "error": "err msg"} Else, it could be anything. If it is another json object, then I'm having no issues. But if the incoming data is an array, then it fails. How do I

[go-nuts] Re: How to use ~/ in terminal with go program?

2016-12-28 Thread Caleb Doxsey
You can use this library: https://godoc.org/github.com/mitchellh/go-homedir#Expand On Wednesday, December 28, 2016 at 8:22:06 AM UTC-5, Aurélien Desbrières wrote: > > As explain ~/ in golang , I > am trying to request the user to cat a file with a

[go-nuts] Re: Do you guys use ORMs when working with SQL?

2016-12-28 Thread Jon Bodner
I've written a library called Proteus that is a simple tool for dynamically generating a data access layer: https://github.com/jonbodner/proteus You need to write the SQL queries, but it will map values (variables, slices, structs, maps) into queries and map the results into a struct or map.

Re: [go-nuts] Converting escaped unicode to utf8

2016-12-28 Thread Jakob Borg
Both json.Unmarshal and strconv.Unquote seem to handle this fine: https://play.golang.org/p/mexmJNGQyh //jb > On 28 Dec 2016, at 15:03, JohnGB wrote: > > I tried this with a variety of messages, and it doesn't work with most > unicode escaped string. For example, the

[go-nuts] concurrent sqlite database access... how to handle?

2016-12-28 Thread Eric Brown
I have a function that you can pass the targeted sqlite database and query information, and it executes that query. This function will be used concurrently in goroutines. The sqlite package I'm using is mattn's (https://github.com/mattn/go-sqlite3). It specifically says that it does not

[go-nuts] Re: too many runtime.gcBgMarkStartWorkers ?

2016-12-28 Thread Dave Cheney
There may be a bug here. IMO the runtime should never try to start more that numCPUs background workers regardless of the size of GOMAXPROCS as that'll just cause contention during the GC cycle. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

[go-nuts] Re: too many runtime.gcBgMarkStartWorkers ?

2016-12-28 Thread Ganesh Sangle
Thanks Dave, we do set the GOMAXPROCS to 64. thanks for explanation. On Wednesday, December 28, 2016 at 12:06:42 AM UTC-8, Ganesh Sangle wrote: > > Hi, > While examining the stack trace from a crash where the process seems to > have become extremely slow, I see a lot of these goroutines: > >

[go-nuts] Re: Chrome not accepting generate_cert.go self-signed SSL certificate

2016-12-28 Thread stevenhmanuel
Hi - Did you ever resolve this on linux? I'm getting the same error under the same conditions. Thanks Steve On Friday, March 13, 2015 at 7:30:07 AM UTC-7, Alex wrote: > > > On windows it gives this error, which can be mitigated by accepting the > certificate: NET::ERR_CERT_AUTHORITY_INVALID

[go-nuts] Re: Behaviour manifested by select statement

2016-12-28 Thread Dave Cheney
Select statements operate in several 'phases', before choosing a channel, or set of channels, that are ready all the arguments on the right hand side of the case expressions are evaluated. Here is your sample code rewritten to make it clear what is happening func main() { sendCh := make(chan

[go-nuts] Behaviour manifested by select statement

2016-12-28 Thread Abhishek Singh
Hi, Below is a sample example, where I'm trying to understand behaviour of select statement. I was hoping the time.After() case clause to succeed but observation is that either of those clauses are executed intermittently. Would help if someone could share what's going on. func

[go-nuts] http: TLS handshake error from :: EOF

2016-12-28 Thread einthusan
I manage a site with very large traffic and using Go 1.8 beta in production. We moved over from a PHP implementation by re-writing everything from scratch in go. We saw a significant drop in our users, and seeing our logs flooding with http: TLS handshake error from :: EOF errors. I am not

[go-nuts] Re: Correct naming of Go !

2016-12-28 Thread João Henrique Machado Silva
Well, the language is called Go, but if you look for just "Go" in Google you will get a bunch of not related stuff. I always look for "golang", but when I am referring to the language I always say "Go Language". Never seen Go+, Go# or Go! though. Em terça-feira, 27 de dezembro de 2016 14:23:20

[go-nuts] Re: How to use ~/ in terminal with go program?

2016-12-28 Thread C Banning
if file[0] == '~' { On Wednesday, December 28, 2016 at 6:22:06 AM UTC-7, Aurélien Desbrières wrote: > > As explain ~/ in golang , I > am trying to request the user to cat a file with a gocat program. > > The point is that if the user tell to the

[go-nuts] Re: list tests without actually running them

2016-12-28 Thread Uli Kunitz
I'm not aware of any option that does that. For the local directory ``` grep 'func *Test' *_test.go | sed 's/func *//;s/(.*$//' ``` should work. I would however recommend to use the Skip method of the testing.T type to prevent test functions from execution. You may want to control skipping

Re: [go-nuts] How to use ~/ in terminal with go program?

2016-12-28 Thread Aurélien Desbrières
That does not fit to my wish, it is certainly readable for you, but not for me. On Wednesday, December 28, 2016 at 2:53:46 PM UTC+1, Konstantin Khomoutov wrote: > > On Wed, 28 Dec 2016 10:25:54 -0300 > Aldrin Leal wrote: > > > > As explain ~/ in golang > > >

Re: [go-nuts] How to use ~/ in terminal with go program?

2016-12-28 Thread Aurélien Desbrières
Well, I do not find the way to make it fit to my code, but that seems it could make the trick if correctly writes. On Wednesday, December 28, 2016 at 2:27:00 PM UTC+1, Aldrin Leal wrote: > > I believe this sums it up pretty well: > >

[go-nuts] Re: Do you guys use ORMs when working with SQL?

2016-12-28 Thread mhhcbon
DBR is a good pick to me. https://github.com/gocraft/dbr It does the little missing from std package. much like previous answer explained it. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

Re: [go-nuts] Converting escaped unicode to utf8

2016-12-28 Thread JohnGB
My response should have read that it produces an error of "invalid character 'Ñ' looking for beginning of value". I got the responses from the two methods mixed up. On Monday, 26 December 2016 17:32:56 UTC+1, rog wrote: > > On 26 December 2016 at 07:23, JohnGB > wrote: >

Re: [go-nuts] Converting escaped unicode to utf8

2016-12-28 Thread JohnGB
I tried this with a variety of messages, and it doesn't work with most unicode escaped string. For example, the unicode escaped string '\u044d\u0442\u043e \u0442\u0435\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435' should unescape to 'это тест сообщение' but it unescapes

Re: [go-nuts] Converting escaped unicode to utf8

2016-12-28 Thread JohnGB
I tried this with a variety of messages, and it doesn't work with most unicode escaped string. For example, the unicode escaped string '\u044d\u0442\u043e \u0442\u0435\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435' should unescape to 'это тест сообщение' but it unescapes

Re: [go-nuts] How to use ~/ in terminal with go program?

2016-12-28 Thread Konstantin Khomoutov
On Wed, 28 Dec 2016 10:25:54 -0300 Aldrin Leal wrote: > > As explain ~/ in golang > > , I am trying to > > request the user to cat a file with a gocat program. > > > > The point is that if the user tell to the terminal the full

[go-nuts] list tests without actually running them

2016-12-28 Thread Sathish VJ
Is there a `go test` option that allows one to list the tests that will be run without actually running them? I have a few tests that have side effects (in the initial stages of development) and I want to ensure that those are not accidentally run. -- You received this message because you are

Re: [go-nuts] How to use ~/ in terminal with go program?

2016-12-28 Thread Aldrin Leal
I believe this sums it up pretty well: http://stackoverflow.com/questions/17609732/expand-tilde-to-home-directory -- -- Aldrin Leal, / http://about.me/aldrinleal On Wed, Dec 28, 2016 at 10:22 AM, Aurélien Desbrières < aurelien.desbrie...@gmail.com> wrote: > As explain ~/

Re: [go-nuts] Converting escaped unicode to utf8

2016-12-28 Thread JohnGB
That look like a nice solution. I'll have to benchmark the methods and see which one wins out in the end. On Monday, 26 December 2016 19:34:16 UTC+1, C Banning wrote: > > If you're processing anonymous messages and don't know where unicode will > occur you might want something like this: >

[go-nuts] How to use ~/ in terminal with go program?

2016-12-28 Thread Aurélien Desbrières
As explain ~/ in golang , I am trying to request the user to cat a file with a gocat program. The point is that if the user tell to the terminal the full address, /home/user/file, the program works, but if the user use ~/file the program brokes. How

[go-nuts] Re: Do you guys use ORMs when working with SQL?

2016-12-28 Thread John Jeffery
There are many good ORMs for Go. One good list can be found at https://awesome-go.com/#orm I think ORMs definitely have their place, and I have made good use of NHibernate in the .NET environment and Hibernate in Java. Having said that, I have found that for almost all of the work I have done

[go-nuts] Re: Kafka with "At least once" for message delivery guarantees

2016-12-28 Thread Caleb Doxsey
These days I would recommend using the confluent consumer: https://github.com/confluentinc/confluent-kafka-go. It's just a wrapper around librdkafka. Sarama works fine too though. With all of these you can configure the behavior you are looking for. For example: request.required.acks would

[go-nuts] Re: too many runtime.gcBgMarkStartWorkers ?

2016-12-28 Thread Dave Cheney
On Wednesday, 28 December 2016 19:06:42 UTC+11, Ganesh Sangle wrote: > > Hi, > While examining the stack trace from a crash where the process seems to > have become extremely slow, I see a lot of these goroutines: > > goroutine 66 [mark worker (idle)]: > runtime.gopark(0x2cf6cf0, 0xc820d1,

[go-nuts] too many runtime.gcBgMarkStartWorkers ?

2016-12-28 Thread Ganesh Sangle
Hi, While examining the stack trace from a crash where the process seems to have become extremely slow, I see a lot of these goroutines: goroutine 66 [mark worker (idle)]: runtime.gopark(0x2cf6cf0, 0xc820d1, 0x29268b0, 0x12, 0x14, 0x0) /usr/local/go/src/runtime/proc.go:185 +0x163