[go-nuts] Testing best practice: passing and failing test

2016-06-16 Thread Rayland
Let's say I have some piece of code like this: type Foo struct { } func (this *Foo) Do() { } If I want to test that method Foo will pass in a certain scenario and fail in another scenario should I have a test for each scenario or should I have all scenarios tested in a method TestFoo_Do()?

[go-nuts] Plurality of package naming

2016-07-12 Thread Rayland
When does it make sense for a package to be named in plural? For example, I'm currently working on a MVC framework and for me it makes sense to have a "controller" package as opposed to "controllers", but I saw that Beego prefers plural for the same case. -- You received this message because y

[go-nuts] Understanding HTTP server latencies

2016-07-18 Thread Rayland
I have an HTTP server in AWS on an instance with 4 cores and 8g of memory. The server is not processing anything, just replying with 500. I have another machine in AWS issuing POST requests with Vegeta. These are my results: *10k req/s * Requests [total, rate]1, 9628.13

Re: [go-nuts] Understanding HTTP server latencies

2016-07-18 Thread Rayland
I thought it was self explanatory, the handler does nothing, just returning an error. On Monday, July 18, 2016 at 4:34:52 PM UTC+3, Peter Waller wrote: > > It really depends on what you're doing while handling your requests. It > may or may not be reasonable. Are you touching external resources

Re: [go-nuts] Understanding HTTP server latencies

2016-07-18 Thread Rayland
Any thoughts on how to attack this problem? On Monday, July 18, 2016 at 4:46:26 PM UTC+3, Michael Jones wrote: > > When you move the rate up by 5x, from 1k => 5k, your wait time moves up by > 2846x. That is suspicious in any system, language, etc. ;-) > > > > *From:

Re: [go-nuts] Understanding HTTP server latencies

2016-07-18 Thread Rayland
The command I used is: vegeta attack -targets=address.txt -body=request.txt -duration=1s -rate=1000 > output.txt On Monday, July 18, 2016 at 4:34:52 PM UTC+3, Peter Waller wrote: > > It really depends on what you're doing while handling your requests. It > may or may not be reasonable. Are you t

[go-nuts] Re: Understanding HTTP server latencies

2016-07-19 Thread Rayland
The problem was the client server. It was too small (1 core, 4G of memory). On Monday, July 18, 2016 at 4:03:26 PM UTC+3, Rayland wrote: > > I have an HTTP server in AWS on an instance with 4 cores and 8g of memory. > The server is not processing anything, just replying with 500. &

[go-nuts] Dynamic type cloning

2016-08-02 Thread Rayland
Let's say I have an object A of some type. Is there a way to create a new object B with the same type as A without knowing the type of A in advance? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receivin

[go-nuts] Re: Dynamic type cloning

2016-08-02 Thread Rayland
values, which contain references to other values, sometimes leading back to > the previous values. > > On Tuesday, 2 August 2016 17:13:21 UTC+10, Rayland wrote: >> >> Let's say I have an object A of some type. Is there a way to create a new >> object B with the same

[go-nuts] Re: Dynamic type cloning

2016-08-02 Thread Rayland
August 2016 18:18:05 UTC+10, Rayland wrote: >> >> I basically need something like this: >> >> var obj = &Person{Name: "John"} // I don't know what type obj will be >> everytime >> var newObj interface{} >> >> initNewObj(obj) // now

[go-nuts] Get all attributes with zero value using reflection

2016-08-02 Thread Rayland
Hi all, How can I use reflect to detect all fields that have the zero value, on a pointer object? Thank you -- 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 g

[go-nuts] Exported singleton in vendor is initialized on every call

2016-11-14 Thread Rayland
Greetings fellow gophers, I have a library in my vendor folder that looks like this: package gorm import ( "fmt" "github.com/jinzhu/gorm" _ "github.com/jinzhu/gorm/dialects/mysql" conf "github.com/spf13/viper" "math/rand" "time" ) var DB *gorm.DB func

[go-nuts] Re: Exported singleton in vendor is initialized on every call

2016-11-14 Thread Rayland
ndi 14 novembre 2016 09:54:40 UTC+1, Rayland a écrit : >> >> Greetings fellow gophers, >> >> I have a library in my vendor folder that looks like this: >> >> package gorm >> >> import ( >>"fmt" >>"github