fatal error: concurrent map writes
воскресенье, 27 мая 2018 г., 16:12:24 UTC+3 пользователь Tamás Gulácsi
написал:
>
> var clients = make(map[string]*http.Client)
>
> func checkProxySOCKS(prox string, c chan QR, wg *sync.WaitGroup) (err
> error) {
>
> defer wg.Done()
>
> httpClient := clients[prox]
> if httpClient == nil{
> dialer, err := proxy.SOCKS5("tcp", prox, nil, proxy.Direct)
> if err != nil {
> return
> }
>
> timeout := time.Duration(1 * time.Second)
>
> httpClient = &http.Client{
> Timeout: timeout,
> Transport: &http.Transport{
> DisableKeepAlives: true,
> Dial: dialer.Dial,
> },
> }
> clients[prox]=httpClient
> }
>
> ...
>
>
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.