refactor: switch to path.Join

This is the _correct_ way to join paths in golang
This commit is contained in:
Jose Diaz-Gonzalez committed 2019-03-05 21:34:26 -05:00
1 parent 884c45de0c
commit a56ae22614
1 file changed
+4 -3
+4 -3
View File
@@ -6,6 +6,7 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"os/user" "os/user"
"path"
"reflect" "reflect"
"strconv" "strconv"
"strings" "strings"
@@ -141,17 +142,17 @@ func PropertySetup(pluginName string) (err error) {
func getPropertyPath(pluginName string, appName string, property string) string { func getPropertyPath(pluginName string, appName string, property string) string {
pluginAppConfigRoot := getPluginAppPropertyPath(pluginName, appName) 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 // getPluginAppPropertyPath returns the plugin property path for a given plugin/app combination
func getPluginAppPropertyPath(pluginName string, appName string) string { 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 // getPluginConfigPath returns the plugin property path for a given plugin
func getPluginConfigPath(pluginName string) string { 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 // makePluginAppPropertyPath ensures that a property path exists