Re: [go-nuts] Re: Conserving memory in TLS handshake and x509 certificate verification

2017-03-15 Thread Nathan Morley
> > What cgo calls were those? Are you using an alternative crypto > implentation? Sadly, I didn't save any of the metrics I gathered any more, so I can't say specifically what CGO calls were being used by my application. I do recall a good bit of the memory being spent on checking the

[go-nuts] Re: Conserving memory in TLS handshake and x509 certificate verification

2017-03-15 Thread Tom
Also quite curious about this. My assumption was that all resources should eventually be cleaned up when http.Client goes out of scope? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

[go-nuts] [ANN] testndoc: the quick and dirty doc generator for rest like apis

2017-03-15 Thread mhhcbon
Hi, If you are looking for a way to quickly document your api based on http, have a look to this package https://github.com/mh-cbon/testndoc Using your test suite, it can generate a simple q documentation. It works by proxy your router and spy the request / responses made on it. For that

[go-nuts] Writing a testable API client in go

2017-03-15 Thread alethenorio
Hi all I have recently taken up golang and as usual the best way for me to learn is to read a lot and dive head in. I am attempting to write an API client as a an exercise and i have run into some best practice design questions which I hope to get some feedback and ideas on how to best

[go-nuts] Re: Conserving memory in TLS handshake and x509 certificate verification

2017-03-15 Thread Dave Cheney
What cgo calls were those? Are you using an alternative crypto implentation? -- 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

[go-nuts] Re: Conserving memory in TLS handshake and x509 certificate verification

2017-03-15 Thread Nathan Morley
Problem resolved. Application was allocating a new http.Client for every remote call made, and since the handshake ultimately comes down to CGO calls, I was accumulating memory that was not managed by Go's GC. On Tuesday, March 14, 2017 at 8:21:58 PM UTC-4, Nathan Morley wrote: > > Hello, > >

[go-nuts] Re: How do I test an func which depends on (pseudo)-random numbers, e.g. rand.Intn()?

2017-03-15 Thread Robert Johnstone
If you are fixing the seed, you are probably over constraining your test. Even though you are calling rand, there must be some post-conditions that the function is supposed to guarantee. In this case, you probably expect all options to be returned with equal probability, so you should call

[go-nuts] Re: How do I test an func which depends on (pseudo)-random numbers, e.g. rand.Intn()?

2017-03-15 Thread mhhcbon
Hi, if you wish not declare a struct and its interface, you might simply make a function type. See https://play.golang.org/p/xuycrPc8sF Then in your main program, you consume the func type, and inject a func impl. It is not as versatile as interface, but that can make the job. -- You

[go-nuts] Re: How do I test an func which depends on (pseudo)-random numbers, e.g. rand.Intn()?

2017-03-15 Thread xiiophen
> > > Also, am I seeding math.rand correctly in the Init() function? Will > seeding it in the Init() function override any seeding I do in my tests? > > You're using time.Now().UTC().UnixNano()) but time.Now().UnixNano() or time.Now().Unix() seem just as good Note UnixNano() may be

[go-nuts] Re: How do I test an func which depends on (pseudo)-random numbers, e.g. rand.Intn()?

2017-03-15 Thread xiiophen
https://golang.org/pkg/math/rand/#Seed *"Seed uses the provided seed value to initialize the default Source to a deterministic state. If Seed is not called, the generator behaves as if seeded by Seed(1). "* So even without calling rand.Seed your output will be the same everytime you run

[go-nuts] Re: How do I test an func which depends on (pseudo)-random numbers, e.g. rand.Intn()?

2017-03-15 Thread Egon
On Wednesday, 15 March 2017 05:45:22 UTC+2, Doug Ireton wrote: > > I'm a new Gopher and I'm working through "Learn Go" by Nathan Youngman > and trying to TDD the exercises to learn how to write testable Go code. > > I have a function to return a random spaceline >