mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
df6af282b9
Changes Details: -------------- Fixes: #36395 Refactoring the code to do the following: 1. Add the method `errBindSourceDoesNotExist` inside `validate.go` to be in-line with the rest of error message 2. Utilised the new method inside `linux_parser.go`, `windows_parser.go` and `validate_test.go` 3. Change the format from `bind mount source path: '%s' does not exist` to `bind mount source path does not exist: %s` 4. Reflected the format change into the 2 unit tests, namely: `volume_test.go` and `validate_test.go` 5. Reflected the format change into `docker_api_containers_test.go` integration test Signed-off-by: Amr Gawish <amr.gawish@gmail.com>
28 lines
682 B
Go
28 lines
682 B
Go
package volume // import "github.com/docker/docker/volume"
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/docker/docker/api/types/mount"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
type errMountConfig struct {
|
|
mount *mount.Mount
|
|
err error
|
|
}
|
|
|
|
func (e *errMountConfig) Error() string {
|
|
return fmt.Sprintf("invalid mount config for type %q: %v", e.mount.Type, e.err.Error())
|
|
}
|
|
|
|
func errBindSourceDoesNotExist(path string) error {
|
|
return errors.Errorf("bind mount source path does not exist: %s", path)
|
|
}
|
|
|
|
func errExtraField(name string) error {
|
|
return errors.Errorf("field %s must not be specified", name)
|
|
}
|
|
func errMissingField(name string) error {
|
|
return errors.Errorf("field %s must not be empty", name)
|
|
}
|