Skip to content

Commit

Permalink
include trace
Browse files Browse the repository at this point in the history
  • Loading branch information
mvid committed Jun 13, 2021
1 parent 1a17a15 commit 239f72a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions docker/opts/opts_unix.go
Expand Up @@ -4,6 +4,7 @@ package opts

import (
"fmt"
"github.com/pkg/errors"
"strings"
)

Expand All @@ -16,7 +17,7 @@ func MountParser(mount string) (source, destination string, err error) {
if len(sd) == 2 {
return sd[0], sd[1], nil
}
return "", "", fmt.Errorf("invalid mount format: got %s, expected <src>:<dst>", mount)
return "", "", errors.Wrap(fmt.Errorf("invalid mount format: got %s, expected <src>:<dst>", mount), "")
}

// VolumeParser parsed volume path.
Expand All @@ -26,12 +27,12 @@ func VolumeParser(volume string) (source, target string, readOnly bool, err erro
if st[2] == "ro" {
return st[0], st[1], true, nil
} else {
return "", "", false, fmt.Errorf("invalid volume format: got %s, expected <src>:<trgt>:ro", volume)
return "", "", false, errors.Wrap(fmt.Errorf("invalid volume format: got %s, expected <src>:<trgt>:ro", volume), "")
}

}
if len(st) == 2 {
return st[0], st[1], false, nil
}
return "", "", false, fmt.Errorf("invalid volume format: got %s, expected <src>:<trgt>", volume)
return "", "", false, errors.Wrap(fmt.Errorf("invalid volume format: got %s, expected <src>:<trgt>", volume), "")
}
4 changes: 2 additions & 2 deletions docker/opts/opts_windows.go
Expand Up @@ -68,7 +68,7 @@ func MountParser(mount string) (source, destination string, err error) {
if len(sd) == 3 {
return sd[0] + sd[1], sd[2], nil
}
return "", "", errors.Wrap(fmt.Errorf("invalid mount format: got %s, expected <drive>:<src>:<dst>", mount), "")
return "", "", errors.Wrap(errors.Wrap(fmt.Errorf("invalid mount format: got %s, expected <drive>:<src>:<dst>", mount), ""), "")
}

// VolumeParser parsed volume path.
Expand All @@ -77,5 +77,5 @@ func VolumeParser(volume string) (source, target string, readOnly bool, err erro
if len(st) == 3 {
return st[1], st[2], false, nil
}
return "", "", false, errors.Wrap(fmt.Errorf("invalid volume format: got %s, expected <drive>:<src>:<trgt>", volume), "")
return "", "", false, errors.Wrap(errors.Wrap(fmt.Errorf("invalid volume format: got %s, expected <drive>:<src>:<trgt>", volume), ""),"")
}

0 comments on commit 239f72a

Please sign in to comment.