1package repositories 2 3import ( 4 e "repodiff/entities" 5 "strings" 6) 7 8func cleanedDiffTarget(target e.DiffTarget) e.DiffTarget { 9 return e.DiffTarget{ 10 Upstream: e.Project{ 11 URL: protocolStrippedURL(target.Upstream.URL), 12 Branch: target.Upstream.Branch, 13 }, 14 Downstream: e.Project{ 15 URL: protocolStrippedURL(target.Downstream.URL), 16 Branch: target.Downstream.Branch, 17 }, 18 } 19} 20 21func protocolStrippedURL(url string) string { 22 startIndex := strings.Index(url, "//") 23 return url[startIndex:] 24} 25