Re: [go-nuts] Parsing XML with namespaces in golang

2017-07-24 Thread Konstantin Khomoutov
On Mon, Jul 24, 2017 at 07:44:33PM -0700, emartinez1...@gmail.com wrote: [...] >>> So I'm trying to unmarshal an XML with namespaces in go but i just can't >>> find the right parser to do so. [...] >> type Root struct { >> XMLName struct{} `xml:"urn:MNResultsResults MNResultsResults"`

[go-nuts] Correct way to track each individual goroutine

2017-07-24 Thread Tamás Gulácsi
See http://godoc.org/go4.org/syncutil/singleflight for another solution. If you key by file name/id, and the function compresses when needed and then returns the (de)compressed file, it'll solve your problem. -- You received this message because you are subscribed to the Google Groups "golang-n

Re: [go-nuts] Re: What is pprof overhead like when gathering a profile?

2017-07-24 Thread 'Jaana Burcu Dogan' via golang-nuts
What we do is to periodically turn on profiling for X seconds, collect some data and turn it off again. We do it at every once a while periodically. We target a single or a group of instances in a large group. On Mon, Jul 24, 2017 at 6:11 PM, Dave Cheney wrote: > Another option is to profile a %

Re: [go-nuts] Why does this program carry test flags once compiled?

2017-07-24 Thread Rob Pike
I haven't got the context but I agree that importing the testing package outside of a test is a very bad idea. If I could, I would disallow it altogether. -rob -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and st

[go-nuts] Correct way to track each individual goroutine

2017-07-24 Thread Glen Huang
I'm writing an image uploading server, and by posting to an url, users can upload an image, and then from another url, they can retrieve it back. The tricky part is that I want to compress the image after uploading. My current design is that uploading is finished as soon as the image is uploade

Re: [go-nuts] Parsing XML with namespaces in golang

2017-07-24 Thread Tamás Gulácsi
No, you don't declare the namespace, but specify that which namespace the tag you're searching for is in. -- 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

[go-nuts] Re: How to determine when to actually use goroutines?

2017-07-24 Thread Glen Huang
I just watched the presentation, it's a good one. Thanks for sharing it. The summary seems more towards how to write goroutines correctly, but it contains good advices and the general message is clear for me now, make things simple and do things sequentially when possible. On Tuesday, July 25,

[go-nuts] Re: How to determine when to actually use goroutines?

2017-07-24 Thread Glen Huang
> Why make them concurrent if you need to know to know the end result of the DB call *before* opening the file? I actually don't need to know the result of the DB call before opening the file, only before sending the file as a response. > only use goroutines when you know for a fact that you h

Re: [go-nuts] Why does this program carry test flags once compiled?

2017-07-24 Thread Chris Broadfoot
One way around the flag problem is to accept an interface, instead of using testing.T. Watch Mitchell Hashimoto's talk from GopherCon from about 39m30s: https://youtu.be/8hQG7QlcLBk?t=2368 http://github.com/mitchellh/go-testing-interface On Mon, Jul 24, 2017 at 1:44 AM, roger peppe wrote: > >

Re: [go-nuts] Parsing XML with namespaces in golang

2017-07-24 Thread emartinez1847
Thanks!. XMLName struct{} `xml:"urn:MNResultsResults MNResultsResults"` Cpcs []float64 `xml:"urn:MNResultsResults ssResultSet>ssResult>cpc"` Is there any reason to declare the namespace 2 times? At first we declare XMLName (which doesn't seem to be used) and then we use urn:MNResult

Re: [go-nuts] Why default stack size is 1gb?

2017-07-24 Thread 张李阳
my mistake, i mean the *max* stack size is 1gb which i saw it here , not the default stack size. Sorry for confusing On Tue, Jul 25, 2017 at 7:33 AM Florin Pățan wrote: > Iirc the default stack size is 2 or 4 kb not 1 gb. Where did you found the

[go-nuts] Re: What is pprof overhead like when gathering a profile?

2017-07-24 Thread Dave Cheney
Another option is to profile a % of requests. In the past I've done that by enabling profiling on a set % of application servers then extrapolating from there. On Tuesday, 25 July 2017 10:55:42 UTC+10, Jaana Burcu Dogan wrote: > > It would be very speculative to provide reference numbers without

Re: [go-nuts] Re: Code Review - Applying functions on custom types

2017-07-24 Thread roger peppe
On 24 July 2017 at 23:21, Sofiane Cherchalli wrote: > Yes, I'm trying to stream CSV values encoded in strings. A schema defines > a type of each value, so I have to parse values to verify they match the > type. Once validation is done, I apply functions on each value. > Is the schema dynamically

[go-nuts] Re: What is pprof overhead like when gathering a profile?

2017-07-24 Thread jbd via golang-nuts
It would be very speculative to provide reference numbers without actually seeing the specific program. You can benchmark the latency/throughput with the CPU profiler on to see a realistic estimate. FWIW, memory profiling, goroutine, thread create profiles are always on. At Google, we continuous

[go-nuts] Re: What is pprof overhead like when gathering a profile?

2017-07-24 Thread Dave Cheney
Here's an entirely unscientific method to determine the overhead of profiling. The Go distribution contains a set of basic benchmarks, one of which is a loopback based http client server benchmark. Running the benchmark with and without profiling gives a rough ballpark for the overhead of profi

[go-nuts] Re: How to determine when to actually use goroutines?

2017-07-24 Thread Dave Cheney
This presentation, or more accurately, the summary at the end, may be of interest to you. https://dave.cheney.net/paste/concurrency-made-easy.pdf A recording of this presentation at GopherCon Signapore is also available by searching for those keywords. On Tuesday, 25 July 2017 01:34:30 UTC+10,

[go-nuts] What is pprof overhead like when gathering a profile?

2017-07-24 Thread nathan
Hello, I am curious what the performance impact of running pprof to collect information about CPU or memory usage is. Is it like strace where there could be a massive slowdown (up to 100x) or is it lower overhead, i.e., safe to use in production? The article here - http://artem.krylysov.com/b

[go-nuts] Re: How to determine when to actually use goroutines?

2017-07-24 Thread nathan
> I need to query a db to get its content type and then send the actually file that lives on the file system. Now the question is, should I put db.QueryRow and os.Open each in a goroutine to make them concurrent? Why make them concurrent if you need to know to know the end result of the DB call

[go-nuts] 10x latency spikes during GC alloc assist phase

2017-07-24 Thread stbaker
Hi, We are experiencing a problem that I believe may be related to issue 14812 but I wanted to ask here before adding to that case or filing a new issue. Of course, we’d also greatly appreciate any advice about how to make our program performant. H

[go-nuts] delve

2017-07-24 Thread rob
Hi. I need help with using delve. Where should I direct my questions? I don't know where else to ask, so I'm asking here first. --rob solomon -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving em

[go-nuts] Ann: pgx v3 - PostgreSQL Driver and Toolkit

2017-07-24 Thread Jack Christensen
pgx is a pure Go driver and toolkit for PostgreSQL. pgx is different from other drivers such as [pq](http://godoc.org/github.com/lib/pq) because, while it can operate as a database/sql compatible driver, pgx is also usable directly. It offers a native interface similar to database/sql that offe

[go-nuts] Why default stack size is 1gb?

2017-07-24 Thread Florin Pățan
Iirc the default stack size is 2 or 4 kb not 1 gb. Where did you found the reference? -- 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...@go

[go-nuts] Re: Code Review - Applying functions on custom types

2017-07-24 Thread Sofiane Cherchalli
Hi Whom, Yes you could with columnar CSV and apply functions to column values, something basically similar to what does spark. In my case I receive streams of rows. Thx -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this gro

Re: [go-nuts] Re: Code Review - Applying functions on custom types

2017-07-24 Thread Sofiane Cherchalli
Yes, I'm trying to stream CSV values encoded in strings. A schema defines a type of each value, so I have to parse values to verify they match the type. Once validation is done, I apply functions on each value. Working with basic types instead of custom types that wrap the basic types, sounds t

Re: [go-nuts] Offline Go Documentation Tools

2017-07-24 Thread Rob Pike
The "go doc" (distinct from "godoc") command works fine offline. It fact it never goes on line. -rob On Tue, Jul 25, 2017 at 2:45 AM, Tyler Compton wrote: > For cursor-sensitive help dialogs, you may find Language Server > Protocol[1] interesting. It provides what you're looking for in Visual

Re: [go-nuts] Re: No Allman-Style, No go!

2017-07-24 Thread Hrobjartur Thorsteinsson
On this last comment, I would like to comment, Overall I agree with last commenter, the coolest programmer is the one that does not have any quarrels about style, just gets along with the group and helps get the job done. That being said, golangs approach to braces a part of logical syntax is unu

Re: [go-nuts] How make fastest map[uint32]uint64 with fixed size(250m)?

2017-07-24 Thread roger peppe
If it's hard to make a perfect hash function, and assuming you don't need modification after initialisation, you could use struct {keys []uint32; vals []uint64}, sort the keys and their associated values, then binary search. By storing keys and values in different slices, you save 25% space because

Re: [go-nuts] How come Math Big module has no Pow functions?

2017-07-24 Thread Jan Mercl
On Mon, Jul 24, 2017 at 5:33 PM me wrote: > The math unit has Pow() functions.. > > How come the Big (math) package has nothing similar? It has: https://golang.org/pkg/math/big/#Int.Exp -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

[go-nuts] Re: How make fastest map[uint32]uint64 with fixed size(250m)?

2017-07-24 Thread Klaus Post
On Monday, 24 July 2017 17:32:48 UTC+2, il wrote: > > I have task: > > 1. Initialize map(250 million items) > 2. Fill all values > 3. Start http server. > 4. Process requests. Iterates all values. > > I need fast "for" and read access with reasonable memory consumption. This > is very important. >

Re: [go-nuts] GoDoc: ignore GOPATH, local serving of help files

2017-07-24 Thread Jan Mercl
On Mon, Jul 24, 2017 at 5:33 PM me wrote: > $ GOPATH= godoc -http :6060 & -- -j -- 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...@googl

Re: [go-nuts] How make fastest map[uint32]uint64 with fixed size(250m)?

2017-07-24 Thread Jan Mercl
On Mon, Jul 24, 2017 at 5:32 PM il wrote: > Can you help me best solution? Create a perfect hash function in 28 bits. Use a [1<<28]T array for the map values. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this g

Re: [go-nuts] Why default stack size is 1gb?

2017-07-24 Thread Jan Mercl
On Mon, Jul 24, 2017 at 5:32 PM taozle wrote: > I found that the default stack size for 64-bit is 1gb, but i can't see any reason for such a large stack, can anyone help me find out the purpose for this? Where did you find that info? AFAICT it's not true. Thread stack size is probably same or si

Re: [go-nuts] Offline Go Documentation Tools

2017-07-24 Thread Tyler Compton
For cursor-sensitive help dialogs, you may find Language Server Protocol[1] interesting. It provides what you're looking for in Visual Studio Code with Go today, and will help provide that functionality to editors like [Neo]vim in the future. 1. http://langserver.org/ On Mon, Jul 24, 2017 at 8:45

Re: [go-nuts] No Allman-Style, No go!

2017-07-24 Thread 'Eric Johnson' via golang-nuts
On Saturday, September 21, 2013 at 7:04:09 AM UTC-7, Michael Daconta wrote: > > As you can see, the code has semi-colons in each required location. So, I > ask you - why is the above code illegal? > Why is breaking the speed limit illegal? On many roads, it is set arbitrarily low because that

Re: [go-nuts] Offline Go Documentation Tools

2017-07-24 Thread andrey mirtchovski
> What do you use to read documentation when you are offline? godoc -http=:6060 -- 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...@googlegro

[go-nuts] How to determine when to actually use goroutines?

2017-07-24 Thread Glen Huang
Hi, I'm still pretty new to go. Hope this question isn't too stupid. I'm writing a restful API server, and in order to send a response, I need to query a db to get its content type and then send the actually file that lives on the file system. Now the question is, should I put db.QueryRow and

[go-nuts] How come Math Big module has no Pow functions?

2017-07-24 Thread me
The math unit has Pow() functions.. How come the Big (math) package has nothing similar? Complications implementing it? Or just no one needed it yet? Here is some brief research I did: https://stackoverflow.com/questions/30182129/calculating-large-exponentiation-in-golang -- You received this

[go-nuts] Offline Go Documentation Tools

2017-07-24 Thread me
Sometimes I want to disconnect my laptop or computer from the internet and work with go.. What do you use to read documentation when you are offline? Here is some brief research I did: http://www.andybritcliffe.com/post/44610795381/offline-go-lang-documentation That appears to be one solution.

Re: [go-nuts] Re: No Allman-Style, No go!

2017-07-24 Thread me
On Saturday, July 22, 2017 at 4:59:04 AM UTC-6, ohir wrote: > > > Every development team has right to reformat source to their tastes on > the editor openfile then reformat to compiler taste on savefile. > Except, that some people are minimalists and don't use fancy editors that have all the

[go-nuts] Re: Math on Huge (2GB) numbers in GoLang

2017-07-24 Thread me
p.s. if the c library GMP was written in times without 8 core processors, wouldn't go be able to use multiple processors better than GMP can? Or, GMP has been modified to utilize more processors recently.. Sorry, I know absolutely nothing about GMP, just that it exists. And, I'm not aware of th

Re: [go-nuts] Math on Huge (2GB) numbers in GoLang

2017-07-24 Thread me
On Saturday, July 22, 2017 at 9:37:16 AM UTC-6, Rémy Oudompheng wrote: > > > The most annoying issue you might encounter is that if your 2GB > strings are numbers printed in base 10, the math/big will not be able > to parse them in a reasonable time using the standard method > (SetString). >

Re: [go-nuts] Math on Huge (2GB) numbers in GoLang

2017-07-24 Thread me
On Saturday, July 22, 2017 at 9:19:44 AM UTC-6, Rémy Oudompheng wrote: > > > I wrote a little module (github/remyoudompheng/bigfft) to play with > FFT-based multiplication of huge integers, while maintaining > interoperability with the math/big package. > > I think I saw that on Github and sta

Re: [go-nuts] Math on Huge (2GB) numbers in GoLang

2017-07-24 Thread me
On Saturday, July 22, 2017 at 9:06:03 AM UTC-6, hsmyers wrote: > > Like everything else, '*it depends…*' > > Do you want speed? > At some point, speed will become important, but if it's under 1 minute or around 2 minutes it's "good enough"... > Do you want the bulk of the coding already avai

[go-nuts] GoDoc: ignore GOPATH, local serving of help files

2017-07-24 Thread me
When running GoDoc locally to serve help documents offline, a server such as this is setup: http://127.0.0.1:6060/pkg/

[go-nuts] How make fastest map[uint32]uint64 with fixed size(250m)?

2017-07-24 Thread il
I have task: 1. Initialize map(250 million items) 2. Fill all values 3. Start http server. 4. Process requests. Iterates all values. I need fast "for" and read access with reasonable memory consumption. This is very important. Can you help me best solution? Thank you! -- You received this mess

[go-nuts] Why default stack size is 1gb?

2017-07-24 Thread taozle
I found that the default stack size for 64-bit is 1gb, but i can't see any reason for such a large stack, can anyone help me find out the purpose for this? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Job Advert

2017-07-24 Thread Adam Alton
Hello, I'm from a startup in Edinburgh, Scotland and we're trying to hire a Senior Go developer and we're trying to spread the word because it's a pretty specialist area. The job can be found here - https://makeitsocial.com/business/img/SeniorDeveloperServerSide.pdf. Is job advertising something

Re: [go-nuts] Expiring map

2017-07-24 Thread DanB
Rajanikanth, If it helps you, have a look on the library we have posted which follows ideas out of implementation of groupcache/lru.go, adding expiring capabilities to LRU (same logic of list indexing behind): https://github.com/cgrates/ltcache DanB On Friday, July 21, 2017 at 2:01:15 AM UTC+2

Re: [go-nuts] [Ann] web2image to take screenshot of web page

2017-07-24 Thread Tong Sun
On Mon, Jul 24, 2017 at 6:44 AM, Konstantin Khomoutov wrote: > On Sun, Jul 23, 2017 at 04:45:24PM -0700, Tong Sun wrote: > > > Please take a look at > > https://github.com/suntong/*web2image*#-web2image > [...] > > -d, --headless use chrome-headless docker as client instead of chrome > [...] >

Re: [go-nuts] encoding/csv: Is this a bug?

2017-07-24 Thread howardcshaw
encoding/csv uses the io.Reader interface, so wouldn't you just need a CR->CR/LF filter that fulfills that interface? Something like https://github.com/andybalholm/crlf should do the trick. Though it would be annoying to deal with when writing a generic program for handling arbitrary input, if

Re: [go-nuts] Understanding least significant byte operation

2017-07-24 Thread Pablo Rozas Larraondo
Thanks Bakul, I think I have a better understanding of what's going on after reading your response. Is it correct to say that the Go compiler treats the prepended minus sign differently depending on the variable being a signed or an unsigned integer? By looking at this example: https://play.golan

Re: [go-nuts] [Ann] web2image to take screenshot of web page

2017-07-24 Thread Konstantin Khomoutov
On Sun, Jul 23, 2017 at 04:45:24PM -0700, Tong Sun wrote: > Please take a look at > https://github.com/suntong/*web2image*#-web2image [...] > -d, --headless use chrome-headless docker as client instead of chrome [...] I think it worth mentioning up-front in the README file that this tool rel

Re: [go-nuts] Why does this program carry test flags once compiled?

2017-07-24 Thread roger peppe
On 24 July 2017 at 09:12, Howard Guo wrote: > Thanks Nigel! I should definitely consider improving the test case. > > Go compiler appears to automatically places test flags into executable > whenever "testing" package is included - no matter the function using > "testing" package is dead code or

Re: [go-nuts] Re: Code Review - Applying functions on custom types

2017-07-24 Thread roger peppe
On 24 July 2017 at 05:10, Sofiane Cherchalli wrote: > Hi Silviu, > > On Sunday, July 23, 2017 at 2:11:29 AM UTC+2, Silviu Capota Mera wrote: >> >> Hi Sofiane, >> >> "Is my design wrong?" >> Without a bigger picture of what your final aim is, it's hard for an >> external observer to tell you if yo

Re: [go-nuts] Understanding least significant byte operation

2017-07-24 Thread Jan Mercl
On Mon, Jul 24, 2017 at 12:25 AM John Souvestre wrote: > That looks like the least significant set bit to me. To me too ;-) But I was responding to your > On Sun, Jul 23, 2017 at 7:26 PM John Souvestre wrote: > >> I believe that the result is the least significant bit, not byte. Where the wo

Re: [go-nuts] Why does this program carry test flags once compiled?

2017-07-24 Thread Howard Guo
Thanks Nigel! I should definitely consider improving the test case. Go compiler appears to automatically places test flags into executable whenever "testing" package is included - no matter the function using "testing" package is dead code or otherwise. So here's a bug report for go: https://git

Re: [go-nuts] Parsing XML with namespaces in golang

2017-07-24 Thread Konstantin Khomoutov
On Sun, Jul 23, 2017 at 01:51:41PM -0700, emartinez1...@gmail.com wrote: Hi! > So I'm trying to unmarshal an XML with namespaces in go but i just can't > find the right parser to do so. [...] This (elided for brewity) 8< package main import ( "fmt"

Re: [go-nuts] [Go2] Proposal remove function return type brackets

2017-07-24 Thread Gert Cuykens
Valid argument thx On Sun, Jul 23, 2017 at 7:23 PM, Rémy Oudompheng wrote: > With this proposal, can you tell whether the following function F > returns one argument (a function) or two arguments (a function and an > error) : > > func F() func(string) []byte, error { >blah > } > > Rémy. > > 2

[go-nuts] Re: Proposal: Blank types instead of Generics for Go 2

2017-07-24 Thread 'meta keule' via golang-nuts
I've updated the proposal to include ideas of how feature parity with generics could be reached. Am Sonntag, 23. Juli 2017 10:17:04 UTC+2 schrieb meta keule: > > > Hi, > > here is a proposal for an alternative to Generics for Go2: > > https://github.com/golang/go/issues/21132 > > Please discuss!