15 lines
240 B
Go
15 lines
240 B
Go
|
|
package utils
|
||
|
|
|
||
|
|
import (
|
||
|
|
"net/url"
|
||
|
|
"path"
|
||
|
|
)
|
||
|
|
|
||
|
|
func URLJoin(baseURL string, paths ...string) string {
|
||
|
|
u, _ := url.Parse(baseURL)
|
||
|
|
pathElements := append([]string{u.Path}, paths...)
|
||
|
|
u.Path = path.Join(pathElements...)
|
||
|
|
|
||
|
|
return u.String()
|
||
|
|
}
|