From 1ed70cfc1e59498f6a483c3265685cdaec9ff16a Mon Sep 17 00:00:00 2001 From: Praveen Kumar Date: Thu, 1 Oct 2020 14:58:36 +0530 Subject: [PATCH] Use LoadFromFile method instead Load for k8s client object To use Load method, first the file needs to be read and passed the content to Load method. LoadFromFile helper do it for us so no need to open the file ourself. --- pkg/crc/machine/kubeconfig.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pkg/crc/machine/kubeconfig.go b/pkg/crc/machine/kubeconfig.go index c0562f856d..bd7b544762 100644 --- a/pkg/crc/machine/kubeconfig.go +++ b/pkg/crc/machine/kubeconfig.go @@ -6,7 +6,6 @@ import ( "crypto/x509" goerrors "errors" "fmt" - "io/ioutil" "net" "net/http" "net/url" @@ -95,11 +94,7 @@ func WriteKubeconfig(ip string, clusterConfig *ClusterConfig) error { } func certificateAuthority(kubeconfigFile string) ([]byte, error) { - bin, err := ioutil.ReadFile(kubeconfigFile) - if err != nil { - return nil, err - } - builtin, err := clientcmd.Load(bin) + builtin, err := clientcmd.LoadFromFile(kubeconfigFile) if err != nil { return nil, err }