简体   繁体   中英

How to get around assignment copies lock value to tr: net/http.Transport contains sync.Mutex

When I run go vet the following error is output:

client.go:2345: assignment copies lock value to tr: net/http.Transport contains sync.Mutex
exit status 1

client.go:2345:

var tr http.Transport

// Setup TLS
if clientConfig.TLSEnabled {
    tr = http.Transport{ // This is line 2345
        TLSClientConfig: &tls.Config{
            InsecureSkipVerify: true,
            MinVersion: tls.VersionTLS11,
        },
    }
}

How can I get around this warning? It's not stopping my builds; but, it's a warning and I don't want warnings.

您应该创建一个*http.Transport指针,而不是值

tr = &http.Transport{

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM