Skip to content

Commit 223bf80

Browse files
committed
cli/context/docker: Endpoint.ClientOpts, withHTTPClient: inline variables
Remove some intermediate variables, and inline them. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 6654ea1 commit 223bf80

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

cli/context/docker/load.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,13 @@ func (ep *Endpoint) ClientOpts() ([]client.Opt, error) {
100100
)
101101

102102
} else {
103-
httpClient := &http.Client{
104-
// No tls
105-
// No proxy
106-
Transport: &http.Transport{
107-
DialContext: helper.Dialer,
108-
},
109-
}
110103
result = append(result,
111-
client.WithHTTPClient(httpClient),
104+
client.WithHTTPClient(&http.Client{
105+
// No TLS, and no proxy.
106+
Transport: &http.Transport{
107+
DialContext: helper.Dialer,
108+
},
109+
}),
112110
client.WithHost(helper.Host),
113111
client.WithDialContext(helper.Dialer),
114112
)
@@ -125,8 +123,7 @@ func withHTTPClient(tlsConfig *tls.Config) func(*client.Client) error {
125123
// Use the default HTTPClient
126124
return nil
127125
}
128-
129-
httpClient := &http.Client{
126+
return client.WithHTTPClient(&http.Client{
130127
Transport: &http.Transport{
131128
TLSClientConfig: tlsConfig,
132129
DialContext: (&net.Dialer{
@@ -135,8 +132,7 @@ func withHTTPClient(tlsConfig *tls.Config) func(*client.Client) error {
135132
}).DialContext,
136133
},
137134
CheckRedirect: client.CheckRedirect,
138-
}
139-
return client.WithHTTPClient(httpClient)(c)
135+
})(c)
140136
}
141137
}
142138

0 commit comments

Comments
 (0)