This question is about the WaitGroup example in the sync package docs: http://golang.org/pkg/sync/#example_WaitGroup
The subject says it already: when a goroutine is tracked by a WaitGroup, is there any reason not to start it with "defer wg.Done()"? The same reasoning than for defering the closing of files etc. applies, one cannot forget to call Done() when, e.g., returning early after an error.
--