Re: [go-nuts] Re: are interface calls to empty methods optimized away - so there is no function call overhead beyond the dereference/jump?

2017-12-04 Thread Dave Cheney
I think you're right. The subtleties escape me as they changed several times around ~1.6 because of the requirements of the concurrent collector. I had thought that _anything_ that was not already pointer shaped was copied and the address of the copy was placed into the interface. On Tuesday, 5

Re: [go-nuts] Re: are interface calls to empty methods optimized away - so there is no function call overhead beyond the dereference/jump?

2017-12-04 Thread 'Axel Wagner' via golang-nuts
Slight correction (I think): If you store a non-pointer in an interface, it won't store the address of the value (variable? values don't have an address, strictly speaking), but will make a copy. Otherwise, this wouldn't work: https://play.golang.org/p/P1YwxBk7lR You can also see these effects here

Re: [go-nuts] Re: GC SW times on Heroku (Beta metrics)

2017-12-04 Thread Henrik Johansson
I am watching with childlike fascination... This is interesting perhaps: gc 130 @2834.158s 0%: 0.056+3.4+2.9 ms clock, 0.45+2.8/5.6/0+23 ms cpu, 8->8->4 MB, 9 MB goal, 8 P gc 131 @2834.178s 0%: 0.023+7.3+0.12 ms clock, 0.18+1.2/5.4/9.2+1.0 ms cpu, 9->9->5 MB, 10 MB goal, 8 P ---> gc 132 @2836.882

Re: [go-nuts] Re: GC SW times on Heroku (Beta metrics)

2017-12-04 Thread Dave Cheney
Oh yeah, I forgot someone added that a while back. That should work. On Tue, Dec 5, 2017 at 6:23 PM, Henrik Johansson wrote: > So it has to run the program? I thought I saw "logfile" scenario in the > examples? > > GODEBUG=gctrace=1 godoc -index -http=:6060 2> stderr.log > cat stderr.log | gcvis

Re: [go-nuts] Re: GC SW times on Heroku (Beta metrics)

2017-12-04 Thread Henrik Johansson
So it has to run the program? I thought I saw "logfile" scenario in the examples? GODEBUG=gctrace=1 godoc -index -http=:6060 2> stderr.log cat stderr.log | gcvis I have shuffled the Heroku logs into Papertrail so I should be able to extract the log lines from there. tis 5 dec. 2017 kl 08:10 skr

Re: [go-nuts] Re: GC SW times on Heroku (Beta metrics)

2017-12-04 Thread Dave Cheney
Probably not for your scenario, gcviz assumes it can run your program as a child. On Tue, Dec 5, 2017 at 6:07 PM, Henrik Johansson wrote: > I found https://github.com/davecheney/gcvis from +Dave Cheney is it a good > choice for inspecting the gc logs? > > tis 5 dec. 2017 kl 07:57 skrev Henrik Joh

[go-nuts] [ANN] gometalinter v2.0.0 released - much faster linting

2017-12-04 Thread Alec Thomas
Hello, Through the efforts of many contributors, and in particular those of Daniel Nephin, v2.0.0 has been released. You can grab it here: https://github.com/alecthomas/gometalinter/releases/tag/v2.0.0 The biggest change since v1.x is that linting is now MUCH more efficient, thanks to the

Re: [go-nuts] Re: GC SW times on Heroku (Beta metrics)

2017-12-04 Thread Henrik Johansson
I found https://github.com/davecheney/gcvis from +Dave Cheney is it a good choice for inspecting the gc logs? tis 5 dec. 2017 kl 07:57 skrev Henrik Johansson : > I have just added the gc tracing and it looks like this more or less all > the time: > > gc 78 @253.095s 0%: 0.032+3.3+0.46 ms clock,

Re: [go-nuts] Re: GC SW times on Heroku (Beta metrics)

2017-12-04 Thread Henrik Johansson
I have just added the gc tracing and it looks like this more or less all the time: gc 78 @253.095s 0%: 0.032+3.3+0.46 ms clock, 0.26+0.24/2.6/2.4+3.6 ms cpu, 11->12->4 MB, 12 MB goal, 8 P gc 79 @253.109s 0%: 0.021+2.1+0.17 ms clock, 0.16+0.19/3.6/1.2+1.3 ms cpu, 9->9->4 MB, 10 MB goal, 8 P gc 80 @

[go-nuts] Re: ssh session

2017-12-04 Thread hiltov
Yes I mean to pass that connection to another Go program. On Tuesday, December 5, 2017 at 5:52:19 AM UTC+3, Jonathan Pittman wrote: > > Elaborate on what you mean by "another place." Do you just need multiple > sessions within your own program or do you need to pass that connection to > another

[go-nuts] swagger

2017-12-04 Thread Jérôme LAFORGE
In my previous projects, I used go-swagger successfully: - to generate code (model) from swagger (still some little bugs sometimes) - to generate swagger file from code based on godoc (you have to follow specific format of godoc. The document is not very clear imho) -- You received this message

[go-nuts] Re: ssh session

2017-12-04 Thread Jonathan Pittman
Elaborate on what you mean by "another place." Do you just need multiple sessions within your own program or do you need to pass that connection to another program (e.g. a proxy command or shared socket connection)? Within your program, once you have dialed an ssh connection and have an *ssh.Cl

Re: [go-nuts] best practice for listening multiple linux TCP port?

2017-12-04 Thread Chao Yuepan
implemented by goroutine per port, Thanks Ian 在 2017年11月29日星期三 UTC+8下午11:42:05,Ian Lance Taylor写道: > > On Tue, Nov 28, 2017 at 10:01 PM, > > wrote: > > > > I have a requirement that our application needs to listen multiple TCP > ports > > (mayebe some hundreds). It is not important why we ha

Re: [go-nuts] corrupt stack?

2017-12-04 Thread Ian Lance Taylor
On Sun, Dec 3, 2017 at 6:42 PM, wrote: > > i'm running go 1.8.3 on linux. about 1 in ~10 billion calls (spread across > many machines), i get > a backtrace that looks like the following: > > panic: runtime error: invalid memory address or nil pointer dereference > [signal SIGSEGV: segmentation v

[go-nuts] Re: benchmark a remote arch

2017-12-04 Thread Dave Cheney
Yes, GOOS= GOARCH= go test -c will produce a binary for the target, the name by default will be the package's name, plus ".test" Copy that to your target and run it ./$package.test -test.bench=. On Tuesday, 5 December 2017 11:56:52 UTC+11, simon place wrote: > > > is it possible, wi

[go-nuts] Re: understanding memory profile

2017-12-04 Thread Dave Cheney
On Tuesday, 5 December 2017 12:09:54 UTC+11, Sangjin Lee wrote: > > A couple of questions on understanding go pprof's memory profile... > > When I list a certain function (with --alloc_objects), I see an allocation > number associated with an import line mysteriously. I am pretty certain I > ca

[go-nuts] Re: are interface calls to empty methods optimized away - so there is no function call overhead beyond the dereference/jump?

2017-12-04 Thread Dave Cheney
On Tuesday, 5 December 2017 12:19:29 UTC+11, simon place wrote: > > in a very similar vein, something i have been wondering about for a while > now; > > when an interface contains a pointer type, does Go double dereference or > conflate the pointers? > If the *type* of the value placed into th

Re: [go-nuts] swagger

2017-12-04 Thread mattherman11
I haven't used either, but I've heard good things about go-swagger on the Go Time podcast . -- 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 a

[go-nuts] Re: are interface calls to empty methods optimized away - so there is no function call overhead beyond the dereference/jump?

2017-12-04 Thread 'simon place' via golang-nuts
in a very similar vein, something i have been wondering about for a while now; when an interface contains a pointer type, does Go double dereference or conflate the pointers? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from

[go-nuts] understanding memory profile

2017-12-04 Thread Sangjin Lee
A couple of questions on understanding go pprof's memory profile... When I list a certain function (with --alloc_objects), I see an allocation number associated with an import line mysteriously. I am pretty certain I can rule out any source line offset. For example, (pprof) list foo Total: 5348

Re: [go-nuts] corrupt stack?

2017-12-04 Thread andrey mirtchovski
Erik, any chance you're hitting this? https://github.com/golang/go/issues/20427 Related article discussing bad ram: https://marcan.st/2017/12/debugging-an-evil-go-runtime-bug/ On Mon, Dec 4, 2017, 5:35 PM 'Keith Randall' via golang-nuts < golang-nuts@googlegroups.com> wrote: > package main > >

[go-nuts] benchmark a remote arch

2017-12-04 Thread 'simon place' via golang-nuts
is it possible, with the go tools, to build the benchmark executable, so i could copy and run it remotely? (for any given os/arch) -- 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,

Re: [go-nuts] corrupt stack?

2017-12-04 Thread 'Keith Randall' via golang-nuts
package main // Convert an *A to a *B, using a data race. // Works for any types A and B. func cast(a *A) *B { var x interface{} go func() { for i := 0; i < 10; i++ { x = a } }() go func() { var b *B for i := 0; i < 10; i++ { x = b } }() for i := 0; i < 10; i++ { b, ok := x.(*B) if o

Re: [go-nuts] os.remove is slow

2017-12-04 Thread Dan Kortschak
Have you tried os.RemoveAll("/var/spool/directory")? https://golang.org/pkg/os/#RemoveAll If that's slow, file an issue. On Mon, 2017-12-04 at 09:41 -0800, gabejessfors...@gmail.com wrote: > What takes 18 seconds in a perl command: > perl -e 'for(<*>){((stat)[9]<(unlink))}' > > is taking almost

[go-nuts] Traceroute

2017-12-04 Thread Camila Luísa
Hello everyone, I'm new with go, so, I try to start with a simple traceroute. I found some examples in github. But they don't work correctly. Attached is the code with a small change that I made to work, but still does not work correctly. The code works only in linux. this is the link to the ori

[go-nuts] Re: Request for feedback: MIDI library for reading and writing SMF and live MIDI data

2017-12-04 Thread me
That Google group doesn't seem to exist. ...Tim... On Wednesday, July 19, 2017 at 3:27:33 AM UTC-7, meta keule wrote: > > Discussion/Google group: https://groups.google.com/forum/#!forum/gomidi > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

[go-nuts] ssh session

2017-12-04 Thread hiltov
Could somebody explain how can I reconnect (reuse) already opened ssh connection in Go. I'm using x/crypto/ssh ssh.Dial function to dial a connection . Then I can start a new session/ run command but I need to use this opened ss.dial connection from another place. How can i do this? Thanx Alex

[go-nuts] Re: Calculation of the combinations between an unlimited number of slices

2017-12-04 Thread Fred
it seems that making a copy of the temp var, replacing : temp = append(temp, c1) by : temp = append(temp, append([]int{}, c1...)) helps, but still unclear for me why the problem was only visible on slice 4... -- You received this message because you are subscribed to the Google Groups "gola

Re: [go-nuts] Re: os.remove is slow

2017-12-04 Thread Reto Brunner
But why? Why does it matter if you are in the same dir or not when you glob? On Mon, Dec 4, 2017, 20:34 Gabriel Forster wrote: > Ding ding ding! We have a winner! Thank you so much. That made a huge > difference. It is now running ~20 seconds. > > The key is being in the same directory. > > > O

Re: [go-nuts] Re: os.remove is slow

2017-12-04 Thread Gabriel Forster
Ding ding ding! We have a winner! Thank you so much. That made a huge difference. It is now running ~20 seconds. The key is being in the same directory. On Monday, December 4, 2017 at 2:17:03 PM UTC-5, Patrick Smith wrote: > > Does it make a difference if you first change directory to > /var/s

Re: [go-nuts] Re: os.remove is slow

2017-12-04 Thread Patrick Smith
Does it make a difference if you first change directory to /var/spool/directory, then glob * and unlink the resulting filenames, without prepending the directory? On Mon, Dec 4, 2017 at 11:05 AM, Gabriel Forster wrote: > Readdirnames wasn't much better. Now using globbing and syscall.Unlink > wh

[go-nuts] Re: os.remove is slow

2017-12-04 Thread Gabriel Forster
Readdirnames wasn't much better. Now using globbing and syscall.Unlink which take ~1minute 30seconds. It is much better, but still a long way from perl's sub-20 seconds. package main import ( "fmt" "path/filepath" "syscall" ) func main() { upperDirPattern := "/var/spool/di

Re: [go-nuts] swagger

2017-12-04 Thread Justin Israel
On Mon, Dec 4, 2017, 7:34 AM Keith Brown wrote: > I am trying to use golang and swagger but I am confused on what package I > should use: > There is: https://github.com/go-swagger/go-swagger or > https://github.com/yvasiyarov/swagger > > Does anyone use Swagger with go and any tips would be much

[go-nuts] Please take the 2017 Gopher Survey

2017-12-04 Thread Steve Francia
Gophers, *We blogged this recently, but haven't started a thread here and want to make sure that we reach as broad a group of Gophers as possible as to provide accurate data. * The Go project wants to hear from you! If you haven't already, please help by participating in our annual survey. Pleas

Re: [go-nuts] Re: os.remove is slow

2017-12-04 Thread Justin Israel
On Tue, Dec 5, 2017, 7:13 AM Gabriel Forster wrote: > As far as I understand, that perl line is by far the fastest way to delete > files in linux. We're talking over 500k files on hdd. > It may be the 500k stats that are killing you. From the looks of your code, the stat seems unnecessary as yo

[go-nuts] Re: os.remove is slow

2017-12-04 Thread Gabriel Forster
As far as I understand, that perl line is by far the fastest way to delete files in linux. We're talking over 500k files on hdd. On Monday, December 4, 2017 at 12:50:54 PM UTC-5, Gabriel Forster wrote: > > What takes 18 seconds in a perl command: > perl -e 'for(<*>){((stat)[9]<(unlink))}' > > i

[go-nuts] Re: os.remove is slow

2017-12-04 Thread Hotei
Gabriel - Thank you for reminding me that perl is a write-only language. It's been a few years since I had to deal with it. How many files are we talking about and on what media? On Monday, December 4, 2017 at 12:50:54 PM UTC-5, Gabriel Forster wrote: > > What takes 18 seconds in a perl comman

[go-nuts] os.remove is slow

2017-12-04 Thread gabejessforster
What takes 18 seconds in a perl command: perl -e 'for(<*>){((stat)[9]<(unlink))}' is taking almost 8 minutes with the following code. Any ideas how I can speed this up? dir, err := os.Open("/var/spool/directory") if err != nil { fmt.Fprintf(w, "failed - " + err.Error())

Re: [go-nuts] corrupt stack?

2017-12-04 Thread David Anderson
Programs with a data race can do all kinds of things that seem incredibly improbable to humans, because compilers assume that the program is race-free and make optimizations that are unsafe in the presence of races. See https://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-what-could-

[go-nuts] Calculation of the combinations between an unlimited number of slices

2017-12-04 Thread fred . softwares
Hi ! I have made a recursive algorithm to compute all the combinations between an unlimited number of slices. The algorithm does good results for 2 and 3 slices. For example with 3 slices a,b,c : a := []int{1,2} b := []int{3,4} c := []int{5,6} final comb [[1 3 5] [1 3 6] [1 4 5] [1 4 6] [2 3 5

Re: [go-nuts] Elphaba Chess

2017-12-04 Thread hughaguilar96
On Monday, December 4, 2017 at 7:11:09 AM UTC-7, Gerald wrote: > > On Sun, 3 Dec 2017 20:07:45 -0800 (PST), you wrote: > > >I'll bet if Mozilla had used Go to write FireFox, rather than invent > their > >own language, Google would have done something to stop them. > > You are aware that Googl

[go-nuts] Re: Should an empty append be an error ?

2017-12-04 Thread Tamás Gulácsi
And along these lines, `append(a, []int{}...)` - appending an empty slice - should be flagged too. Which would be a pain in the ass for a lot of use cases! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop r

[go-nuts] Re: Should an empty append be an error ?

2017-12-04 Thread 'Bryan Mills' via golang-nuts
The spec defines `append` as a variadic function, with a type of the form append(s S, x ...T) S // T is the element type of S Variadic functions, in general, accept zero or more parameters. (Consider fmt.Println().) In order to reject empty appends, append would either have to have its own s

Re: [go-nuts] Elphaba Chess

2017-12-04 Thread 'David Chase' via golang-nuts
On Sunday, December 3, 2017 at 1:57:58 AM UTC-5, Ian Lance Taylor wrote: > > On Sat, Dec 2, 2017 at 11:37 AM, > > wrote: > > > > Google is not going to be happy if somebody uses Go to compete against > > Google. > > I think that Go is a nice language, but it's not so nice that it would > mak

Re: [go-nuts] Elphaba Chess

2017-12-04 Thread Gerald Henriksen
On Sun, 3 Dec 2017 20:07:45 -0800 (PST), you wrote: >I'll bet if Mozilla had used Go to write FireFox, rather than invent their >own language, Google would have done something to stop them. You are aware that Google helps fund Firefox (through their agreement to be the default search engine)? >

Re: [go-nuts] corrupt stack?

2017-12-04 Thread Jan Mercl
On Mon, Dec 4, 2017 at 1:57 PM wrote: > i should have mentioned the race detector found nothing. jan, can you give an example of a go program > setting a pointer to -1 without using unsafe? this requires the gc to have free'd something that is still live, > doesn't it? See https://research.swtch

Re: [go-nuts] corrupt stack?

2017-12-04 Thread quanstro
i should have mentioned the race detector found nothing. jan, can you give an example of a go program setting a pointer to -1 without using unsafe? this requires the gc to have free'd something that is still live, doesn't it? - erik On Monday, December 4, 2017 at 2:58:22 AM UTC-8, Peter Walle

[go-nuts] Re: profiling webserver with pprof and router middleware

2017-12-04 Thread Karan Chaudhary
Great find! On Saturday, 2 December 2017 15:57:18 UTC+5:30, basti skalendudler wrote: > > > > I finally found the problem!!! > > Since I am using a custom mux, I n

Re: [go-nuts] corrupt stack?

2017-12-04 Thread Peter Waller
Some worthwhile reading: https://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-what-could-possibly-go-wrong Races are important, and if your program has a race, otherwise impossible-seeming things can happen. First ruling out races is a worthwhile activity. In terms of debugging it,

Re: [go-nuts] corrupt stack?

2017-12-04 Thread Jan Mercl
If course it can. On Mon, Dec 4, 2017, 07:46 wrote: > a program not using unsafe cannot set a pointer to -1, even if there is a > race, right? > > - erik > > > On Sunday, December 3, 2017 at 10:20:44 PM UTC-8, Jan Mercl wrote: > >> On Mon, Dec 4, 2017 at 7:03 AM wrote: >> >> > does anyone have

[go-nuts] How to add a GUI to your Golang app in 5 easy steps

2017-12-04 Thread Asticode
Hey guys, I've just written a short article on how to add a GUI to your Golang app using astilectron and I'm sharing it here: https://medium.com/@so