Reputation: 9439
In my GO project I am getting an error in transport.go
file as,
mygo/testkit/pkg/http
mygo/testkit/pkg/http pkg\http\transport.go:93: unknown http.Transport field 'ExpectContinueTimeout' in struct literal
Here is my newDefaultTransport()
function, which gives the error in transport.go
.
func newDefaultTransport() *http.Transport {
return &http.Transport{
DisableCompression: disableCompression,
DisableKeepAlives: defaultDisableKeepAlives,
MaxIdleConnsPerHost: defaultMaxIdleConnsPerHost,
ResponseHeaderTimeout: defaultResponseHeaderTimeout,
ExpectContinueTimeout: defaultExpectContinueTimeout,
TLSHandshakeTimeout: defaultTLSHandshakeTimeout,
TLSClientConfig: newTLSClientConfig(),
Proxy: http.ProxyFromEnvironment,
Dial: func(network, addr string) (net.Conn, error) {
return NewTimeoutConnDial(network, addr, TCPDialTimeout, TCPKeepAlive, defaultIdleTimeout)
},
}
}
And I am getting the error at this line,
ExpectContinueTimeout: defaultExpectContinueTimeout,
What will be the reason for this error? How to solve this? I am new to this GO
framework.
Upvotes: 0
Views: 1364
Reputation: 121059
The ExpectContinueTimeout field was added in Go 1.6. Upgrade your version of Go.
Upvotes: 1