func FixUrl(site *url.URL, nextLoc string) string { var newUrl string if strings.HasPrefix(nextLoc, "//") { google.com/example.php newUrl = site.Scheme + ":" + nextLoc } else if strings.HasPrefix(nextLoc, "http") { http://google.com || https://google.com newUrl = nextLoc } else if !strings.HasPref
(mainSite *url.URL, nextLoc string)
| 70 | // } |
| 71 | |
| 72 | func FixUrl(mainSite *url.URL, nextLoc string) string { |
| 73 | nextLocUrl, err := url.Parse(nextLoc) |
| 74 | if err != nil { |
| 75 | return "" |
| 76 | } |
| 77 | return mainSite.ResolveReference(nextLocUrl).String() |
| 78 | } |
| 79 | |
| 80 | func Unique(intSlice []string) []string { |
| 81 | keys := make(map[string]bool) |
no test coverage detected