Re: [go-nuts] Golang periodically executing a go routine

2016-12-22 Thread DM
Thanks :) . On Wednesday, 21 December 2016 15:42:55 UTC+5:30, Axel Wagner wrote: > > You need to pass the WaitGroup as a pointer. This way, connectionsCount > creates a WaitGroup, increments it's counts, passes a copy of it to count > and then waits on the original; count, however, only Done()s

Re: [go-nuts] Golang periodically executing a go routine

2016-12-21 Thread 'Axel Wagner' via golang-nuts
You need to pass the WaitGroup as a pointer. This way, connectionsCount creates a WaitGroup, increments it's counts, passes a copy of it to count and then waits on the original; count, however, only Done()s its copy. go vet should probably complain about that, as it contains an appropriate marker

[go-nuts] Golang periodically executing a go routine

2016-12-21 Thread DM
I am trying write a small golang program which will periodically execute lsof -i: to check number of open TCP connections at a port. Code looks like below:- package main import ( "fmt" "log" "os/exec" "strings" "sync" "time" ) type Lsof struct { Command string