[go-nuts] Re: How to manage a web portal with multiple services without stopping and restarting everything at each release/fix?

2016-06-17 Thread Simon Ritchie
This is not a question about Go, but basic web infrastructure. However, it's one of those "best practice" questions which "everybody knows the answer to" and so you may be hard put to find out more without knowing where to start. First of all, I should point out that when you tweak your PHP

Re: [go-nuts] Re: [ANN] primegen.go: Sieve of Atkin prime number generator

2016-06-17 Thread
On Friday, June 17, 2016 at 2:30:12 AM UTC+2, gordo...@gmail.com wrote: > > > Modern x86 CPUs don't work like that. > > > In general, optimally scheduled assembly code which uses more registers > has higher performance than optimally scheduled assembly code which uses > smaller number of

Re: [go-nuts] Re: [ANN] primegen.go: Sieve of Atkin prime number generator

2016-06-17 Thread gordonbgood
I don't see the point of the exercise other than it proves that not putting the result of an operation back into the same register reduces the latency slightly for your processor (whatever it is?); I suspect that if you used any other register such as the unused AX register rather then the R11

[go-nuts] Re: Currying in Go

2016-06-17 Thread paraiso . marc
What is the point of doing that in a language that doesn't support auto currying ? There is none. You are not currying anything by the way, you just wrote 3 closures. Le vendredi 17 juin 2016 00:00:43 UTC+2, Zauberkraut a écrit : > > Hello, > > Go enables the evaluation of functions using

[go-nuts] Re: How to manage a web portal with multiple services without stopping and restarting everything at each release/fix?

2016-06-17 Thread Romano
Hi Tamás, thanks, I will have a look. I guess and hope that this is what I need. @Simon: thanks for the response with so many details. I have been working for years for projects with load balancers, HA, disaster recovery sites, and so on so your detailed answer can be really helpful to

[go-nuts] Re: Go 1.7 Beta 2 is released

2016-06-17 Thread paraiso . marc
Thanks, is there a way to know what to expect in later versions ( 1.8,1.9,1.10 and so forth ... ) ? Le vendredi 17 juin 2016 01:15:18 UTC+2, Chris Broadfoot a écrit : > > Hello gophers, > > We have just released go1.7beta2, a beta version of Go 1.7. > It is cut from the master branch at the

Re: [go-nuts] Re: Golang Error - When marshelling data

2016-06-17 Thread Konstantin Khomoutov
On Fri, 17 Jun 2016 00:50:20 -0700 (PDT) User123 wrote: [...] > When i return http response from a function should i use > *func makeCalls() (string, error, *http.Response, error) * > or > *func makeCalls() (string, error, http.Response, error) * > > For the struct i

Re: [go-nuts] CPU fairness in goroutine scheuding

2016-06-17 Thread Sam Whited
On Fri, Jun 17, 2016 at 2:23 PM, Dmitry Orlov wrote: > If I understand it correctly, go scheduler instruments code with additional > yield points not related to I/O. That can help fairness too. It will sometimes pre-empt on function calls, but this can get a bit hairy

Re: [go-nuts] export struct method to C-code as callback (cgo-related)

2016-06-17 Thread Andrey Salnikov
Hi Andrey! thanks for answer! But actually I don't understand how to receive context inside callback from C-code. May be I'm wrong here but as I understand you mean that I have to identify instance of *A using callback parameters received from C-side. But what about if I'll receive only sum of

[go-nuts] encoding/json: any way to receive number literal "10.0" into integer field?

2016-06-17 Thread jgold
We have an upstream provider of JSON data which sends integer data types as floating point literals with a "0" decimal part. By default json.Decoder doesn't allow this and fails: https://play.golang.org/p/MEJlg1n3vs Unfortunately this provider is almost certain not to change this, and so we

Re: [go-nuts] Re: encoding/json: any way to receive number literal "10.0" into integer field?

2016-06-17 Thread Matt Harden
https://play.golang.org/p/8R6QmYw_28 On Fri, Jun 17, 2016 at 3:08 PM Evan Digby wrote: > To further this, if you do need your internal model to be a concrete > struct rather than interface this approach still fits: > > https://play.golang.org/p/_wrgN1FltA > > > On Friday,

[go-nuts] Re: go1.7beta2 prints "too many values in struct initializer" when I ran "go test" for gopkg.in/vmihailenco/msgpack.v2

2016-06-17 Thread Dave Cheney
go test -work should do it. On Saturday, 18 June 2016 12:02:03 UTC+10, Hiroaki Nakamura wrote: > > Hi, > > Here are commands I used to set up gopkg.in/vmihailenco/msgpack.v2 > > go get -u gopkg.in/vmihailenco/msgpack.v2 > cd $GOPATH/src/gopkg.in/vmihailenco/msgpack.v2 > go get -u

[go-nuts] Re: Currying in Go

2016-06-17 Thread Tyler Compton
I would also like to hear from somebody about a real world use-case. I don't pretend to be proficient in this realm of functional programming, but I would be very surprised if this is valuable in a language like Go that can and does hold state. That said, this is very cool and I would love to

Re: [go-nuts] Re: [ANN] primegen.go: Sieve of Atkin prime number generator

2016-06-17 Thread gordonbgood
Here is a golang version of Daniel Bernstein's "eratspeed", which is a straight translation of his C code to golang without any changes other than as necessary to make it work: https://play.golang.org/p/Sd6qlMQcHF. It won't run on the golang playground because it takes too long unless one

Re: [go-nuts] encoding/json: any way to receive number literal "10.0" into integer field?

2016-06-17 Thread Edward Muller
AFAIK (and someone will probably provide something better) you need to do something like this: https://play.golang.org/p/riq-m6cgZu > On Jun 17, 2016, at 2:37 PM, jg...@bitgirder.com wrote: > > We have an upstream provider of JSON data which sends integer data > types as floating point

Re: [go-nuts] export struct method to C-code as callback (cgo-related)

2016-06-17 Thread andrey mirtchovski
If the library made no provision for the caller to give a unique token which would help to identify it in the callback then that library does not expect to have more than one caller-and-callback in play at any one time, or, even worse, expects you to arrange some thread-local storage in the caller

[go-nuts] Re: encoding/json: any way to receive number literal "10.0" into integer field?

2016-06-17 Thread Evan Digby
One approach to deal with this would be to abstract your internal model as an interface from the model you receive and mutate them to match. This also gives you the power to truncate/round/mutate a float however best suites your needs rather than hoping the library truncates/rounds/mutates in a

Re: [go-nuts] Re: [ANN] primegen.go: Sieve of Atkin prime number generator

2016-06-17 Thread gordonbgood
On Friday, June 17, 2016 at 4:48:06 PM UTC+2, gordo...@gmail.com wrote: > > I don't see the point to the exercise as far as optimizing golang is > > concerned. > It is a general rule that using more registers results in faster code. Yes, except when they're wasted as in using the extra register

Re: [go-nuts] Re: importer.Default not able to find packages in $GOPATH

2016-06-17 Thread Joshua Liebow-Feeser
'go install' worked; thanks a ton! I'll also take a look at the other stuff you mentioned because I'm curious about the details. On Fri, Jun 17, 2016 at 5:15 PM, adonovan via golang-nuts < golang-nuts@googlegroups.com> wrote: > On Friday, 17 June 2016 15:21:55 UTC-4, Joshua Liebow-Feeser wrote:

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

2016-06-17 Thread paraiso . marc
By the way, Go 1.7 support subtests : https://tip.golang.org/pkg/testing/#hdr-Subtests_and_Sub_benchmarks Which is one of the nicest additions to Go 1.7 Le jeudi 16 juin 2016 16:04:11 UTC+2, Rayland a écrit : > > Let's say I have some piece of code like this: > > type Foo struct { > } > > func

Re: [go-nuts] Re: [ANN] primegen.go: Sieve of Atkin prime number generator

2016-06-17 Thread
On Friday, June 17, 2016 at 3:52:27 PM UTC+2, gordo...@gmail.com wrote: > > I don't see the point of the exercise other than it proves that not > putting the result of an operation back into the same register reduces the > latency slightly for your processor (whatever it is?); I suspect that if

[go-nuts] When should I use the connection pool?

2016-06-17 Thread cydside
Hi to all, I'm new here and using golang too. I've read some articles and post on Connection Pooling" but I'm still confused. What I'm looking for is a rule of thumb that make me easy to decide when use connection pool. My scenario isn't so complicated: - a web application that makes CRUD

[go-nuts] Gomobile: Large .so/aar file sizes on Android

2016-06-17 Thread rajiivkanchan
Hi All I am using Go version 1.6.2 and Gomobile (sha +6b7a416 from the tip) and to build an Android library. Our code is mostly networking "encoding/json" "fmt" "log" "math/rand" "net" "sort" "time" -- You received this message because you are subscribed to the Google Groups

[go-nuts] export struct method to C-code as callback (cgo-related)

2016-06-17 Thread andrey
Hello, Could you guys please help me. I can't find how to export method function which belongs to some go-struct to C-code (cgo part) as callback. I know how to export simple function which not belongs to any type and use it as callback for C-function, but is it possibly to export method of

Re: [go-nuts] Re: [ANN] primegen.go: Sieve of Atkin prime number generator

2016-06-17 Thread gordonbgood
I don't see the point to the exercise as far as optimizing golang is concerned. Your experiment just shows that Your compiler (GCC?) missed an optimization as far as reducing backend latency goes. You may also find that swapping the order of some of the instructions such as the second and the

[go-nuts] Re: importer.Default not able to find packages in $GOPATH

2016-06-17 Thread adonovan via golang-nuts
On Friday, 17 June 2016 15:21:55 UTC-4, Joshua Liebow-Feeser wrote: > > Hi All, > > I'm trying to use the go/* packages to parse and type check Go source > code. I've downloaded github.com/coreos/etcd to test this on, and I'm > currently trying it out in the etcdserver subdirectory. When I run

Re: [go-nuts] encoding/json: any way to receive number literal "10.0" into integer field?

2016-06-17 Thread jonathan
Thanks -- I should have clarified that we've ruled that option out (it was our first approach), since we want to stick to the built in types that won't require explicit exchange with the primitive types. jonathan On Fri, Jun 17, 2016 at 02:56:49PM -0700, Edward Muller wrote: > AFAIK (and someone

[go-nuts] Re: Golang Error - When marshelling data

2016-06-17 Thread User123
Have found the cause of the issue The message that I was trying to marshall had *0x10a3c2d0 (when fmt.Println) *which was http response. >From https://github.com/revel/revel/issues/1037 i found that *Since Go 1.6 http.Request struct contains `Cancel <-chan struct{}` which* *results in `json:

[go-nuts] Re: map memory usage question

2016-06-17 Thread Egon
On Friday, 17 June 2016 02:59:49 UTC+3, kortschak wrote: > > I'm running a terabyte-scale (minor compiler changes are necessary to get > this to run) genome resequencing simulation at the moment and an > interesting question has arisen. > The simulation involved hashing over ~all positions of a

Re: [go-nuts] Re: [ANN] primegen.go: Sieve of Atkin prime number generator

2016-06-17 Thread gordonbgood
> Looks like something is wrong with immediate loading for the 1 << ... > operation. Could you open a bug with repro instructions? I can look at it > when 1.8 opens. I have opened a golang issue #16092 as follows: https://github.com/golang/go/issues/16092 I may have over-complicated it,

[go-nuts] Re: polymorphism (for Go 2.0), new fast playground is live

2016-06-17 Thread charraster
On Thursday, June 16, 2016 at 3:20:10 PM UTC+2, Sean Russell wrote: > > I'm sorry -- the "share" button doesn't seem to be working, or doesn't > work in Firefox or Chrome. And I have a window hung on "waiting for remote > server," so I might have broken your playground. > TL:DR type