From a56ae22614452a27dd290beddb339e499742e743 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 21 Jan 2019 18:23:45 -0500 Subject: [PATCH] refactor: switch to path.Join This is the _correct_ way to join paths in golang --- plugins/common/properties.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/common/properties.go b/plugins/common/properties.go index 1965398e0..529aeb0d7 100644 --- a/plugins/common/properties.go +++ b/plugins/common/properties.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "os" "os/user" + "path" "reflect" "strconv" "strings" @@ -141,17 +142,17 @@ func PropertySetup(pluginName string) (err error) { func getPropertyPath(pluginName string, appName string, property string) string { pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName) - return strings.Join([]string{pluginAppConfigRoot, property}, "/") + return path.Join(pluginAppConfigRoot, property) } // getPluginAppPropertyPath returns the plugin property path for a given plugin/app combination func getPluginAppPropertyPath(pluginName string, appName string) string { - return strings.Join([]string{getPluginConfigPath(pluginName), appName}, "/") + return path.Join(getPluginConfigPath(pluginName), appName) } // getPluginConfigPath returns the plugin property path for a given plugin func getPluginConfigPath(pluginName string) string { - return strings.Join([]string{MustGetEnv("DOKKU_LIB_ROOT"), "config", pluginName}, "/") + return path.Join(MustGetEnv("DOKKU_LIB_ROOT"), "config", pluginName) } // makePluginAppPropertyPath ensures that a property path exists