[go-nuts] Re: database/sql : i have a need to use postgresql numeric column data type for currency / money value processing

2018-01-07 Thread Alex Rice
An interesting question (I am just learning Go). Anyways I found this- maybe relevant for you: https://github.com/shopspring/decimal -- 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 i

[go-nuts] Re: gofmt: one line if statement

2018-01-07 Thread gavingrover
At the moment func declarations leave it for the user, depending on whether the original was written on one line or not. gofmt will change: func hi(){fmt.Println("Hi.")} func bye(){ fmt.Println("Bye.")} into: func hi() { fmt.Println("Hi.") } func bye() { fmt.Pri

[go-nuts] Re: gofmt: one line if statement

2018-01-07 Thread Jeff Goldberg
Yes, but ... First the "yes" part. I find myself writing one line if statements, and then finding myself annoyed at gofmt. When I write a one line if statement, there is a presentational reason for it. But But such formatting would have to be an all or nothing thing if we wanted consistency

[go-nuts] Re: database/sql : i have a need to use postgresql numeric column data type for currency / money value processing

2018-01-07 Thread matthewjuran
Why avoid using a bigint column storing cents? Matt On Sunday, January 7, 2018 at 9:29:51 AM UTC-6, evan wrote: > > c# has a decimal type that i can map my numeric(12,2) column data type to, > but golang doesnt have a decimal type. > > i'm trying to avoid storing money values as cents then conve

[go-nuts] database/sql : i have a need to use postgresql numeric column data type for currency / money value processing

2018-01-07 Thread evan
c# has a decimal type that i can map my numeric(12,2) column data type to, but golang doesnt have a decimal type. i'm trying to avoid storing money values as cents then converting them to dollar values when needed, and also would like to stay close to using database/sql's standard API as much a

Re: [go-nuts] Meet "fatal morestack on g0" on Linux

2018-01-07 Thread shenli
#1 0x004293f2 in runtime.futexsleep (addr=0x1b0a950 , val=0, ns=-1) at /usr/local/go/src/runtime/os_linux.go:45 I dive into the source code of golang 1.9.2 and find this: https://github.com/golang/go/blob/bf9ad7080d0a22acf502a60d8bc6ebbc4f5340ef/src/runtime/os_linux.go#L45 > // Som

[go-nuts] Re: gofmt: one line if statement

2018-01-07 Thread matthewjuran
I like the C if one-liner without curly braces but that doesn't apply to Go since the if condition isn't in parenthesis. if (exists == false) i++; I've never liked the non-braces version of if when across multiple lines. In JavaScript I've started always writing out if like in Go and will prob

Re: [go-nuts] Is it reasonable?

2018-01-07 Thread T L
ok On Sunday, January 7, 2018 at 6:09:45 AM UTC-5, Jan Mercl wrote: > > On Sun, Jan 7, 2018 at 11:57 AM T L > > wrote: > > Yes. The choice is to raise a runtime error or not. When not, the value > does not really matter because every value of an integer variable > represents an integer number a

[go-nuts] Re: gofmt: one line if statement

2018-01-07 Thread Tim Heckman
I think that this is a good question. I do question whether your code examples are more or less simple when they are a single line. I'm worried they may be more compact, which hurts the readability, while still retaining the same complexity. Being that you should be running `gofmt` before commi

Re: [go-nuts] Meet "fatal morestack on g0" on Linux

2018-01-07 Thread shenli
The same problem occurs again with the same error message. The pstack result: > Thread 1 (process 12230): > #0 runtime.futex () at /usr/local/go/src/runtime/sys_linux_amd64.s:439 > #1 0x004293f2 in runtime.futexsleep (addr=0x1b0a950 > , val=0, ns=-1) at /usr/local/go/src/runtime/os_linux

Re: [go-nuts] Meet "fatal morestack on g0" on Linux

2018-01-07 Thread shenli
We enable race detection in the test environment and disable it when building to be published binaries. I double checked the building environment to make sure the race detection is disabled. For we care the performance very much. On Saturday, January 6, 2018 at 7:04:09 PM UTC+8, Dave Cheney wrot

Re: [go-nuts] Is it reasonable?

2018-01-07 Thread Jan Mercl
On Sun, Jan 7, 2018 at 11:57 AM T L wrote: Yes. The choice is to raise a runtime error or not. When not, the value does not really matter because every value of an integer variable represents an integer number and there is no combination of the bits left unused for NaN, Inf, etc. FTR, the value i

[go-nuts] Is it reasonable?

2018-01-07 Thread T L
package main import "math" import "fmt" func main() { var c = math.Inf(1) fmt.Printf("%x \n", int64(c)) // -8000 fmt.Printf("%x \n", int32(c)) // -8000 fmt.Printf("%x \n", int16(c)) // 0 fmt.Printf("%x \n", int8(c)) // 0 c = math.Inf(-1) fmt.Printf("%

[go-nuts] How to send multiple responses (file upload progress) to the client?

2018-01-07 Thread Val
Hello Jason Can you give us a bit more details about the components in your architecture? >From what I understand you have a go backend, a GCS bucket, and a client. So far, I've had best results for performance, security and simplicity with this combination: - backend generates a Signed upload UR