mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #40647 from thaJeztah/simplify_is_abs
pkg/system: minor linting issues and refactor
This commit is contained in:
commit
26f8c7de91
3 changed files with 5 additions and 7 deletions
|
@ -130,12 +130,10 @@ func mkdirWithACL(name string, sddl string) error {
|
|||
// 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
|
||||
}
|
||||
if filepath.IsAbs(path) || strings.HasPrefix(path, string(os.PathSeparator)) {
|
||||
return true
|
||||
}
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
// The origin of the functions below here are the golang OS and windows packages,
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
func TestCheckSystemDriveAndRemoveDriveLetter(t *testing.T) {
|
||||
// Fails if not C drive.
|
||||
_, err := CheckSystemDriveAndRemoveDriveLetter(`d:\`, pathdriver.LocalPathDriver)
|
||||
if err == nil || (err != nil && err.Error() != "The specified path is not on the system drive (C:)") {
|
||||
if err == nil || err.Error() != "The specified path is not on the system drive (C:)" {
|
||||
t.Fatalf("Expected error for d:")
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,6 @@ func IsProcessAlive(pid int) bool {
|
|||
func KillProcess(pid int) {
|
||||
p, err := os.FindProcess(pid)
|
||||
if err == nil {
|
||||
p.Kill()
|
||||
_ = p.Kill()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue