Merge pull request #7527 from thaJeztah/remove_sys_isabs

sys: remove unused IsAbs() (windows)
This commit is contained in:
Akihiro Suda 2022-10-16 22:13:20 +09:00 committed by GitHub
commit 691b4ea85f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,9 +18,7 @@ package sys
import ( import (
"os" "os"
"path/filepath"
"regexp" "regexp"
"strings"
"syscall" "syscall"
"unsafe" "unsafe"
@ -134,19 +132,3 @@ func mkdirWithACL(name string) error {
} }
return nil return nil
} }
// IsAbs is a platform-specific wrapper for filepath.IsAbs. On Windows,
// golang filepath.IsAbs does not consider a path \windows\system32 as absolute
// as it doesn't start with a drive-letter/colon combination. However, in
// docker we need to verify things such as WORKDIR /windows/system32 in
// a Dockerfile (which gets translated to \windows\system32 when being processed
// by the daemon. This SHOULD be treated as absolute from a docker processing
// perspective.
func IsAbs(path string) bool {
if !filepath.IsAbs(path) {
if !strings.HasPrefix(path, string(os.PathSeparator)) {
return false
}
}
return true
}