From 5173c55223a76ef53f13db5c4c7ded36330aea72 Mon Sep 17 00:00:00 2001 From: srstack Date: Mon, 16 May 2022 14:41:58 +0800 Subject: [PATCH] if -> switch --- pkg/cluster/spec/profile.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/cluster/spec/profile.go b/pkg/cluster/spec/profile.go index 2b59532e28..7ad4ba7c5d 100644 --- a/pkg/cluster/spec/profile.go +++ b/pkg/cluster/spec/profile.go @@ -61,11 +61,12 @@ func Initialize(base string) error { tiupData := os.Getenv(tiuplocaldata.EnvNameComponentDataDir) tiupHome := os.Getenv(tiuplocaldata.EnvNameHome) - if tiupData != "" { + switch { + case tiupData != "": profileDir = tiupData - } else if tiupHome != "" { + case tiupHome != "": profileDir = path.Join(tiupHome, tiuplocaldata.StorageParentDir, base) - } else { + default: homeDir, err := getHomeDir() if err != nil { return errors.Trace(err)