[go-nuts] Re: Arguments for writing fast, high-load servers in Go instead of Scala?

2017-02-18 Thread Will Faught
Thanks to the two replies so far! Very helpful. Here are the reasons I'd thought of before sending the question. I don't know Scala, so maybe some of these aren't advantages relative to Scala in particular; if so, please let me know. Ideas and feedback are much appreciated! # Concurrency and p

Re: [go-nuts] is this race condition normal?

2017-02-18 Thread Jesse McNelis
On Sun, Feb 19, 2017 at 3:59 PM, Marwan abdel moneim wrote: > i'm reading a book about concurrency, and was doing some baby steps > so i'm trying to manage a variable changes to be locked when a process > starts and freed when it ends > > this is the initial code https://play.golang.org/p/qGraa8yQ

Re: [go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-18 Thread Bharath B
Hi, I am trying to read those values and store in DB. Regards, Bharath B -- 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 golang-nuts+unsubscr...@googlegroups.co

Re: [go-nuts] Re: int16 and float64 Multiplication

2017-02-18 Thread ngjunyen
After some testing I just decided to instead round the numbers to 2 decimals instead. Thank you for the heads up though. On Sunday, February 19, 2017 at 5:42:15 PM UTC+11, Michael Jones wrote: > > This feels unlikely. > > You might want to verify that the calculation matches your expectations >

Re: [go-nuts] Re: int16 and float64 Multiplication

2017-02-18 Thread Michael Jones
This feels unlikely. You might want to verify that the calculation matches your expectations exactly at many values. Ian's representation argument applies at every word size it may be that you just hit a "lucky" happenstance. On Sat, Feb 18, 2017 at 11:59 PM wrote: > Thank you for your help. I

Re: [go-nuts] Re: Struggling with working directory

2017-02-18 Thread Sayth Renshaw
On Tuesday, 14 February 2017 11:53:45 UTC+11, Diego Medina wrote: > > > Not sure why its being difficult. > > knowing why I needed a GOPATH and what it was used for was probably the > main issue I had when I started with Go too, some 3+ years ago, we'll help > you get through it. Now, if you go

Re: [go-nuts] is this race condition normal?

2017-02-18 Thread andrey mirtchovski
If I may add: undetected race conditions are also a problem. -- 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 golang-nuts+unsubscr...@googlegroups.com. For more op

[go-nuts] is this race condition normal?

2017-02-18 Thread Daniel Theophanes
All detected race conditions are a problem. Use a mutex. -- 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 golang-nuts+unsubscr...@googlegroups.com. For more option

Re: [go-nuts] Re: Arguments for writing fast, high-load servers in Go instead of Scala?

2017-02-18 Thread Diego Medina
On Saturday, February 18, 2017 at 10:29:03 PM UTC-5, Will Faught wrote: > > Definitely not my first rodeo. :) Been using Go professionally for a > couple years. I've done a lot of Java stuff in the past, and I suspect > Scala/JVM work will be as burdensome. > Great! hope you and your team get

[go-nuts] is this race condition normal?

2017-02-18 Thread Marwan abdel moneim
i'm reading a book about concurrency, and was doing some baby steps so i'm trying to manage a variable changes to be locked when a process starts and freed when it ends this is the initial code https://play.golang.org/p/qGraa8yQEc and this is my solution https://play.golang.org/p/wC9tcbpVjf my q

[go-nuts] Re: int16 and float64 Multiplication

2017-02-18 Thread ngjunyen
Thank you for your help. I managed to get the result I needed by using 32 bit floats. On Sunday, February 19, 2017 at 3:36:06 PM UTC+11, ngju...@gmail.com wrote: > > I am trying to multiply an int16 and float64 in Golang 1.8 but the result > it returns is incorrect. I need this number to be exac

Re: [go-nuts] int16 and float64 Multiplication

2017-02-18 Thread Ian Lance Taylor
On Sat, Feb 18, 2017 at 7:52 PM, wrote: > I am trying to multiply an int16 and float64 in Golang 1.8 but the result it > returns is incorrect. I need this number to be exact for some hash > verification. Any ideas why this might be happening? > > int16(10) // 10 > float64(int16(10)) // 10 > > flo

[go-nuts] int16 and float64 Multiplication

2017-02-18 Thread ngjunyen
I am trying to multiply an int16 and float64 in Golang 1.8 but the result it returns is incorrect. I need this number to be exact for some hash verification. Any ideas why this might be happening? int16(10) // 10 float64(int16(10)) // 10 float64(3.99) // 3.99 float64(int16(10)) * float64(3.99)

Re: [go-nuts] Re: Arguments for writing fast, high-load servers in Go instead of Scala?

2017-02-18 Thread Will Faught
Definitely not my first rodeo. :) Been using Go professionally for a couple years. I've done a lot of Java stuff in the past, and I suspect Scala/JVM work will be as burdensome. On Sat, Feb 18, 2017 at 1:30 PM Diego Medina wrote: > The reasons we have for moving our Scala heavy process app to Go

Re: [go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-18 Thread roger peppe
It sounds to me like the encoding/json package in the standard library might do what you want. On 18 Feb 2017 15:04, wrote: > Hi, > > I am learning Go language and also to technical terms like in subject > "struct member path" (don't know if right). > > I need help to initialize a nested structu

Re: [go-nuts] 9fans.net/go

2017-02-18 Thread Dave MacFarlane
client doesn't implement ReadByte, and opening a plumbing port with 9fans.net/go/plumb9fans/net/go/plumb needs a ByteReader is the change that I've been vendoring for other OSes to be able to open the "edit" port of the plumber. The problem that I'm having now isn't that it doesn't build, it's tha

Re: [go-nuts] Question about net/http package implementation

2017-02-18 Thread Matt Harden
Correction. They didn't say *r2 := *r; they said r2 := *r. Also read the example. They returned &r2 instead of r2. The code is equivalent to but shorter than the original. On Sat, Feb 18, 2017 at 3:11 PM Matt Harden wrote: They didn't say *r2 := *r; he said r2 := *r. Also read the example. The

Re: [go-nuts] Question about net/http package implementation

2017-02-18 Thread Matt Harden
They didn't say *r2 := *r; he said r2 := *r. Also read the example. They returned &r instead of r. The code is equivalent but shorter than the code in the package. On Sat, Feb 18, 2017 at 2:32 PM Dan Kortschak wrote: > On Fri, 2017-02-17 at 22:59 -0800, vova...@gmail.com wrote: > > I'm wondering

Re: [go-nuts] Re: Google Grumpy (Python->Go)

2017-02-18 Thread Paul Boddie
On Saturday 18. February 2017 23.45.13 Dylan Trotter wrote: > Interesting. Thanks for the perspective. I did take a look at the PyPy ast > module but I guess I got scared off by the PyPy specific requriements. > > I ended up integrating pythonparser > which

Re: [go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-18 Thread Matt Harden
Why do you want to to this? What are you actually trying to accomplish? See http://xyproblem.info/ On Sat, Feb 18, 2017 at 7:04 AM wrote: > Hi, > > I am learning Go language and also to technical terms like in subject > "struct member path" (don't know if right). > > I need help to initialize a

Re: [go-nuts] 9fans.net/go

2017-02-18 Thread Bakul Shah
On Sat, 18 Feb 2017 21:42:05 GMT Dave MacFarlane wrote: > Are there any cross-platform alternatives to 9fans.net/go for > interacting with the Plan9/p9p plumber? I think you will have to create os specific versions of 9fans.net/go/plan9/client/dial.go:Namespace() > It doesn't seem to be maintain

[go-nuts] Building Go from Source / Managing my ${GOROOT}

2017-02-18 Thread Ayan George
I'm somewhat new to go and I've been relying on FreeBSD and Ubuntu packages for the compiler. I decided to try building Go from source to get go1.8 and I realized it is really convenient to simply clone the repo into my ${GOROOT}/src (which is now simply ${HOME}/go), build Go (I did extract 1.8 bi

Re: [go-nuts] Re: Google Grumpy (Python->Go)

2017-02-18 Thread Dylan Trotter
Interesting. Thanks for the perspective. I did take a look at the PyPy ast module but I guess I got scared off by the PyPy specific requriements. I ended up integrating pythonparser which is a pure Python parser for Python 2.x and 3.x. I'm very impressed wi

Re: [go-nuts] Question about net/http package implementation

2017-02-18 Thread Dan Kortschak
On Fri, 2017-02-17 at 22:59 -0800, vova...@gmail.com wrote: > I'm wondering, if there's any benefit of writing* r2 := new(Request); > *r2 = *r *rather than shorter *r2 := *r (example below) *or this is > just matter of style preference? *r2 := *r is not legal. https://play.golang.org/p/28y-zWhvoQ

[go-nuts] Re: Golang server background notofication process

2017-02-18 Thread Diego Medina
Hi, See below: My first idea was to make some background process, which will scrape rooms > every 30 seconds, save the results *(in mongo, in cookies or somewhere > else, advise me please)*, match new scrape results with previous and save > differences (new rooms) in DB for future posting to

Re: [go-nuts] Re: Why Go doesn't see my local package?

2017-02-18 Thread Diego Medina
see inline comments: > > > " don't use relative imports like the one you posted from the "The Way to > Go", that is't really what you are supposed to do. " > > Why? > > What is the difference with "you are supposed to do"? what is the behavior > of using the dot? > > There are several reasons yo

Re: [go-nuts] Re: Why Go doesn't see my local package?

2017-02-18 Thread Matt Harden
https://github.com/golang/go/issues/3515#issuecomment-66066361 On Sat, Feb 18, 2017 at 7:04 AM Angel Java Lopez wrote: > Hi! > > Just curious... About: > > " don't use relative imports like the one you posted from the "The Way to > Go", that is't really what you are supposed to do. " > > Why? >

[go-nuts] 9fans.net/go

2017-02-18 Thread Dave MacFarlane
Are there any cross-platform alternatives to 9fans.net/go for interacting with the Plan9/p9p plumber? It doesn't seem to be maintained (I've had to vendor a bug fix for a while to use it to receive plumbing messages) and I just discovered while trying to use my de text editor on Plan 9 that, ironi

[go-nuts] Re: Arguments for writing fast, high-load servers in Go instead of Scala?

2017-02-18 Thread Diego Medina
The reasons we have for moving our Scala heavy process app to Go are: 1. Much, much smaller memory footprint, both, initial app running and then loading the same number of items from our database. 2. During development, compilation time. 3. Version upgrades: As long as you vendor your Go depe

[go-nuts] redeclaration in runtime/utf8.go after installing Go 1.8 on Windows

2017-02-18 Thread Vincent Rischmann
Hi, I'm on Windows, I had Go 1.7.4 installed from the MSI installer. Today I decided to upgrade to Go 1.8, so I downloaded the new MSI, ran it and that was it. However, first package I tried to install I got the following errors: G:\Gopath\src\github.com\google> go get -u -v github.com/vris

[go-nuts] Golang server background notofication process

2017-02-18 Thread egortictac3
Hello. I apologize in advance for my bad english. I've created simple training service in golang, which supports login and registration system with MongoDB. This service allows you to scrape rooms for rent in London in specified location if you loggedin. So, now I want to implement notificati

[go-nuts] Question about net/http package implementation

2017-02-18 Thread vovanec
Just seen the following code in net/http package, request.go: func (r *Request) WithContext(ctx context.Context) *Request { if ctx == nil { panic("nil context") } r2 := new(Request) *r2 = *r r2.ctx = ctx return r2 } I'm wondering, if there's any benefit of writing* r2 := new(Request); *r2

[go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-18 Thread bharathgowda23
Hi, I am learning Go language and also to technical terms like in subject "struct member path" (don't know if right). I need help to initialize a nested structure like below, by getting the struct member names at runtime. type jsonData struct { DataReference []struct { ParameterTyp

Re: [go-nuts] Re: Why Go doesn't see my local package?

2017-02-18 Thread Angel Java Lopez
Hi! Just curious... About: " don't use relative imports like the one you posted from the "The Way to Go", that is't really what you are supposed to do. " Why? What is the difference with "you are supposed to do"? what is the behavior of using the dot? In other worlds, like NodeJS, it's very co

[go-nuts] Re: ActiveState seeking Go community feedback

2017-02-18 Thread Egon
On Friday, 4 November 2016 06:02:50 UTC+2, Nate Finch wrote: > > I'm curious to know what Activestate plans to bring to the table that > isn't already a part of the go distributions people can download off of > golang.org. I see it mentions the distribution including "popular > modules" (I pres

[go-nuts] Re: Can anyone provide an example or stopping and/or starting an established Windows service?

2017-02-18 Thread Egon
Just checking whether I got my message across clearly :). When I said, whether the code is up to date, I meant whether you had the latest golang.org/x/sys? But yeah, sounds really weird. Do you get empty lines or nil at least? What version of go? Anyways, I would then go try adding println-s in

[go-nuts] Re: Can anyone provide an example or stopping and/or starting an established Windows service?

2017-02-18 Thread akcorr
Same thing. Code runs and I get nothing. That's really weird. On Friday, February 17, 2017 at 3:06:47 PM UTC-5, akc...@gmail.com wrote: > > I copied your code from playground. I will make that change and let you > know. > > > On Friday, February 17, 2017 at 2:07:38 PM UTC-5, Egon wrote: >> >>

Re: [go-nuts] Arguments for writing fast, high-load servers in Go instead of Scala?

2017-02-18 Thread Henrik Johansson
The cognitive difference is huge in Go's favor. Aside from that the new impressive gc results built for low latency can be a good argument. We have deployed a number of services in Go over the past months and are very happy with the performance. We used to do all these in Java but Go is easier to