switch https <-> ssh urls
(gitPath string)
| 66 | |
| 67 | // switch https <-> ssh urls |
| 68 | func switchURLType(gitPath string) string { |
| 69 | var newGitURL string |
| 70 | if strings.HasPrefix(gitPath, "https") { |
| 71 | splitURL := strings.Split(gitPath, "/") |
| 72 | newGitURL = fmt.Sprintf("git@%s:%s", splitURL[2], strings.Join(splitURL[3:], "/")) |
| 73 | } else { |
| 74 | splitURL := strings.Split(gitPath, "@") |
| 75 | replacedURL := strings.ReplaceAll(splitURL[1], ":", "/") |
| 76 | newGitURL = fmt.Sprintf("https://%s", replacedURL) |
| 77 | } |
| 78 | return newGitURL |
| 79 | } |
| 80 | |
| 81 | func DownloadDependency(ctx context.Context, workingDirectory string, source *latest.SourceConfig, log log.Logger) (configPath string, err error) { |
| 82 | downloadMutex.Lock() |
no outgoing calls