IsLocal uses the go-getter FileDetector to check if source is a file
(source string)
| 55 | |
| 56 | // IsLocal uses the go-getter FileDetector to check if source is a file |
| 57 | func IsLocal(source string) bool { |
| 58 | pwd := util.GetCwd() |
| 59 | |
| 60 | // ref: https://github.com/hashicorp/go-getter/blob/master/detect_test.go |
| 61 | out, err := getter.Detect(source, pwd, getter.Detectors) |
| 62 | |
| 63 | match, err := regexp.MatchString("^file://.*", out) |
| 64 | if err != nil { |
| 65 | log.Panicf("invalid source format %s", err) |
| 66 | } |
| 67 | |
| 68 | return match |
| 69 | } |
| 70 | |
| 71 | func withPWD(pwd string) func(*getter.Client) error { |
| 72 | return func(c *getter.Client) error { |