refactor: use path/filepath instead of path for joining path parts

This commit is contained in:
Jose Diaz-Gonzalez authored and Jose Diaz-Gonzalez committed 2020-11-21 20:57:33 -05:00
1 parent ff7429fd00
commit 943e032d12
2 files changed
+6 -6

No files matched your search

+2 -2
View File
@@ -4,7 +4,7 @@ import (
"bufio" "bufio"
"fmt" "fmt"
"os" "os"
"path" "path/filepath"
"github.com/dokku/dokku/plugins/common" "github.com/dokku/dokku/plugins/common"
) )
@@ -58,7 +58,7 @@ func TriggerPostExtract(appName string, sourceWorkDir string) {
return return
} }
buildpacksPath := path.Join(sourceWorkDir, ".buildpacks") buildpacksPath := filepath.Join(sourceWorkDir, ".buildpacks")
file, err := os.OpenFile(buildpacksPath, os.O_RDWR|os.O_TRUNC|os.O_CREATE, 0600) file, err := os.OpenFile(buildpacksPath, os.O_RDWR|os.O_TRUNC|os.O_CREATE, 0600)
if err != nil { if err != nil {
common.LogFail(fmt.Sprintf("Error writing .buildpacks file: %s", err.Error())) common.LogFail(fmt.Sprintf("Error writing .buildpacks file: %s", err.Error()))
+4 -4
View File
@@ -7,7 +7,7 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"os/user" "os/user"
"path" "path/filepath"
"reflect" "reflect"
"strconv" "strconv"
"strings" "strings"
@@ -447,17 +447,17 @@ func PropertySetup(pluginName string) 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 path.Join(pluginAppConfigRoot, property) return filepath.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 path.Join(getPluginConfigPath(pluginName), appName) return filepath.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 path.Join(MustGetEnv("DOKKU_LIB_ROOT"), "config", pluginName) return filepath.Join(MustGetEnv("DOKKU_LIB_ROOT"), "config", pluginName)
} }
// makePluginAppPropertyPath ensures that a property path exists // makePluginAppPropertyPath ensures that a property path exists