Skip to content

Commit 2847d88

Browse files
committed
style: Clone the global instead of mutating
Runitor is a CLI tool and what we are doing is kosher w.r.t mutating the global instance, but then again it costs to hear about this from linters.
1 parent 67a0b6e commit 2847d88

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

internal/api.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,7 @@ var (
4949
// http.DefaultTransport with a TLS Client Session Cache, to enable TLS session
5050
// resumption.
5151
func NewDefaultTransportWithResumption() *http.Transport {
52-
t, ok := http.DefaultTransport.(*http.Transport)
53-
if !ok {
54-
panic("cannot assert DefaultTranport to *Transport")
55-
}
56-
52+
t := http.DefaultTransport.(*http.Transport).Clone()
5753
t.TLSClientConfig = &tls.Config{
5854
ClientSessionCache: tls.NewLRUClientSessionCache(1),
5955
}

0 commit comments

Comments
 (0)