GetSourcePath gets a unique local source directory name. For local modules, it use the local directory
(source string)
| 43 | |
| 44 | // GetSourcePath gets a unique local source directory name. For local modules, it use the local directory |
| 45 | func GetSourceDir(source string) string { |
| 46 | if !IsLocal(source) { |
| 47 | h := md5.New() |
| 48 | io.WriteString(h, source) |
| 49 | source = base64.StdEncoding.EncodeToString(h.Sum(nil)) |
| 50 | return path.Join(constants.TemplatesDir, source) |
| 51 | } else { |
| 52 | return source |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // IsLocal uses the go-getter FileDetector to check if source is a file |
| 57 | func IsLocal(source string) bool { |