Both are correct. The first form is cleaner and scales well if you intend to extend your code later, e.g. if you later decide you want to launch not 2 but 3 or 4 or N goroutines, the code will not change in structure, you just add the additional goroutines.
Another reason why the first form is "popular" is because often after launching the "worker" goroutines there are more things to do which may be executed on this goroutine (before
wg.Done() is called).
The 2nd form on the other hand is more efficient, as it only launches one additional goroutine. Goroutines are lightweight, cheap, but they are not "free". This may be improved further by using the
WaitGroup to only "track" the launched goroutine, obviously the "main" that calls
wg.Wait() does not need to wait for itself explicitly. And if only 1 goroutine remains, you may use other synchronization means instead of
WaitGroup (e.g. a channel).
So basically if performance is critial, use the 2nd approach.