From 4a0b9b6d7a455452272e15695909389177a3dcf1 Mon Sep 17 00:00:00 2001 From: cheliequan <liequanche@126.com> Date: 星期一, 22 五月 2023 16:03:11 +0800 Subject: [PATCH] 解决编译问题 --- src/main/main.go | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/main.go b/src/main/main.go index 747ff8d..c788412 100644 --- a/src/main/main.go +++ b/src/main/main.go @@ -8,14 +8,11 @@ "path/filepath" "time" - "../create" - "../delete" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" "basic.com/aps/aps_deploy.git/src/create" "basic.com/aps/aps_deploy.git/src/delete" - "basic.com/aps/aps_deploy.git/src/util" ) var ( @@ -56,7 +53,7 @@ } // 閰嶇疆 Kubernetes 闆嗙兢鐨� kubeconfig 璺緞 - kubeconfig := flag.String("kubeconfig", filepath.Join(util.homeDir(), ".kube", "config"), "kubeconfig file") + kubeconfig := flag.String("kubeconfig", filepath.Join(homeDir(), ".kube", "config"), "kubeconfig file") flag.Parse() // 鍒涘缓 Kubernetes 瀹㈡埛绔� @@ -148,3 +145,11 @@ } } +// homeDir 鑾峰彇褰撳墠鐢ㄦ埛鐨勫鐩綍璺緞 +func homeDir() string { + if h := os.Getenv("HOME"); h != "" { + return h + } + return os.Getenv("USERPROFILE") // Windows 鐜涓嬭幏鍙栫敤鎴风洰褰� +} + -- Gitblit v1.8.0