From d4522c7ffe802413d95be4d18b92803594559d5b Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Sat, 1 May 2021 22:54:52 +0200 Subject: [PATCH] fix validation for docker volumes --- internal/config.go | 2 +- internal/location.go | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/internal/config.go b/internal/config.go index dbd99e0..4fb7013 100644 --- a/internal/config.go +++ b/internal/config.go @@ -12,7 +12,7 @@ import ( "github.com/spf13/viper" ) -const VERSION = "1.0.8" +const VERSION = "1.0.9" var CI bool = false var VERBOSE bool = false diff --git a/internal/location.go b/internal/location.go index b587969..0a0edc3 100644 --- a/internal/location.go +++ b/internal/location.go @@ -49,14 +49,16 @@ func (l Location) validate(c *Config) error { if l.From == "" { return fmt.Errorf(`Location "%s" is missing "from" key`, l.name) } - if from, err := GetPathRelativeToConfig(l.From); err != nil { - return err - } else { - if stat, err := os.Stat(from); err != nil { + if l.getType() == TypeLocal { + if from, err := GetPathRelativeToConfig(l.From); err != nil { return err } else { - if !stat.IsDir() { - return fmt.Errorf("\"%s\" is not valid directory for location \"%s\"", from, l.name) + if stat, err := os.Stat(from); err != nil { + return err + } else { + if !stat.IsDir() { + return fmt.Errorf("\"%s\" is not valid directory for location \"%s\"", from, l.name) + } } } }