For the purpose of variable scoping, files have no meaning in Go. Think of all files in a package as if they would be concatenated, which (simplified) is exactly what happens before compilation.
That means: No, there is no way of scoping a variable to a file.
If you need two global WaitGroup
s, you need to define them as individual variables.