fix(client/snowflake.go): prevent wg.Add race condition

In VSCode, the staticcheck tool emits this warning:

> should call wg.Add(1) before starting the goroutine to
> avoid a race (SA2000)go-staticcheck

To avoid this warning, just move wg.Add outside.
This commit is contained in:
Simone Basso 2021-05-03 10:23:03 +02:00
parent 8e0b5bd20a
commit aefabe683f

View file

@ -56,8 +56,8 @@ func socksAcceptLoop(ln *pt.SocksListener, transport *sf.Transport, shutdown cha
break break
} }
log.Printf("SOCKS accepted: %v", conn.Req) log.Printf("SOCKS accepted: %v", conn.Req)
go func() {
wg.Add(1) wg.Add(1)
go func() {
defer wg.Done() defer wg.Done()
defer conn.Close() defer conn.Close()