func withWG(wg *sync.WaitGroup, fn func()) { wg.Add(1) go func() { defer wg.Done() fn() }() } Here wg is not found by AnalyseFuncCall