cheliequan
2023-05-22 4a0b9b6d7a455452272e15695909389177a3dcf1
解决编译问题
1个文件已修改
13 ■■■■■ 已修改文件
src/main/main.go 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 环境下获取用户目录
}