Skip to content

Commit feeb3ff

Browse files
Use linux as a default for inputOS
Signed-off-by: Gabriel Adrian Samfira <[email protected]>
1 parent d6124fc commit feeb3ff

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

util/system/path.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package system
33
import (
44
"path"
55
"path/filepath"
6-
"runtime"
76
"strings"
87

98
"github.com/pkg/errors"
@@ -34,6 +33,10 @@ func DefaultPathEnv(os string) string {
3433
// - optionally keep the trailing slashes on paths
3534
// - paths are returned using forward slashes
3635
func NormalizePath(parent, newPath, inputOS string, keepSlash bool) (string, error) {
36+
if inputOS == "" {
37+
inputOS = "linux"
38+
}
39+
3740
newPath = toSlash(newPath, inputOS)
3841
parent = toSlash(parent, inputOS)
3942
origPath := newPath
@@ -105,6 +108,10 @@ func fromSlash(inputPath, inputOS string) string {
105108
// On Windows we remove the drive letter and convert the path delimiter to "\".
106109
// Paths that begin with os.PathSeparator are considered absolute even on Windows.
107110
func NormalizeWorkdir(current, wd string, inputOS string) (string, error) {
111+
if inputOS == "" {
112+
inputOS = "linux"
113+
}
114+
108115
wd, err := NormalizePath(current, wd, inputOS, false)
109116
if err != nil {
110117
return "", errors.Wrap(err, "normalizing working directory")
@@ -129,7 +136,7 @@ func NormalizeWorkdir(current, wd string, inputOS string) (string, error) {
129136
// - Are UNC paths
130137
func IsAbs(pth, inputOS string) bool {
131138
if inputOS == "" {
132-
inputOS = runtime.GOOS
139+
inputOS = "linux"
133140
}
134141
cleanedPath, err := CheckSystemDriveAndRemoveDriveLetter(pth, inputOS)
135142
if err != nil {
@@ -170,7 +177,7 @@ func IsAbs(pth, inputOS string) bool {
170177
// \\.\C$\a --> Fail
171178
func CheckSystemDriveAndRemoveDriveLetter(path string, inputOS string) (string, error) {
172179
if inputOS == "" {
173-
inputOS = runtime.GOOS
180+
inputOS = "linux"
174181
}
175182

176183
if inputOS != "windows" {

0 commit comments

Comments
 (0)