Skip to content

Commit 9a5c14a

Browse files
authored
fix crane's root.go after DefaultTransport change (#1450)
1 parent e3b94c7 commit 9a5c14a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

cmd/crane/cmd/root.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,13 @@ func New(use, short string, options []crane.Option) *cobra.Command {
7070

7171
options = append(options, crane.WithPlatform(platform.platform))
7272

73-
rt := remote.DefaultTransport
74-
if t, ok := remote.DefaultTransport.(interface {
75-
Clone() *http.Transport
76-
}); ok {
77-
t := t.Clone()
78-
t.TLSClientConfig = &tls.Config{
79-
InsecureSkipVerify: insecure, //nolint: gosec
80-
}
73+
transport := remote.DefaultTransport.(*http.Transport).Clone()
74+
transport.TLSClientConfig = &tls.Config{
75+
InsecureSkipVerify: insecure, //nolint: gosec
8176
}
8277

78+
var rt http.RoundTripper = transport
79+
8380
// Add any http headers if they are set in the config file.
8481
cf, err := config.Load(os.Getenv("DOCKER_CONFIG"))
8582
if err != nil {

0 commit comments

Comments
 (0)