defer wg.Done() will be called when main function ends. I suppose you forget to put Done function into the worker function.
you are calling Add(1), and calling Wait() without calling Done()
func main() {
//var sharedlock sync.Mutex
var wg sync.WaitGroup
worker := func() {
defer wg.Done()
for i := 0; i < 100000; i++ {
//pass
}
}
go worker()
wg.Add(1)
wg.Wait()