MakeURL accepts a string or url.URL as argument and returns escaped URL prepended with repository URL.
(location any)
| 93 | |
| 94 | // MakeURL accepts a string or url.URL as argument and returns escaped URL prepended with repository URL. |
| 95 | func (r *Repository) MakeURL(location any) string { |
| 96 | switch location := location.(type) { |
| 97 | case string: |
| 98 | tempURL := url.URL{ |
| 99 | Path: r.RepoLink + "/" + location, |
| 100 | } |
| 101 | return tempURL.String() |
| 102 | case url.URL: |
| 103 | location.Path = r.RepoLink + "/" + location.Path |
| 104 | return location.String() |
| 105 | default: |
| 106 | panic("location type must be either string or url.URL") |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | // PullRequestURL returns URL for composing a pull request. |
| 111 | // This function does not check if the repository can actually compose a pull request. |
no test coverage detected