Skip to content

Commit

Permalink
Use platform-aware filepath.Join instead of path.Join
Browse files Browse the repository at this point in the history
  • Loading branch information
wongma7 committed Mar 9, 2021
1 parent e860bab commit 8362129
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"fmt"
"net/url"
"os"
"path"
"path/filepath"
"strings"

Expand Down Expand Up @@ -59,13 +58,13 @@ func ParseEndpoint(endpoint string) (string, string, error) {
return "", "", fmt.Errorf("could not parse endpoint: %v", err)
}

addr := path.Join(u.Host, filepath.FromSlash(u.Path))
addr := filepath.Join(u.Host, filepath.FromSlash(u.Path))

scheme := strings.ToLower(u.Scheme)
switch scheme {
case "tcp":
case "unix":
addr = path.Join("/", addr)
addr = filepath.Join("/", addr)
if err := os.Remove(addr); err != nil && !os.IsNotExist(err) {
return "", "", fmt.Errorf("could not remove unix domain socket %q: %v", addr, err)
}
Expand Down

0 comments on commit 8362129

Please sign in to comment.