overflow_probes/util/url/url.go
crusader 6fb6bc66d8 ing
2017-09-22 18:20:07 +09:00

21 lines
332 B
Go

package util
import (
"net/url"
"path"
)
// Join is concat URL string and path
// ex) http://127.0.0.1/ and /entry
func Join(u string, p string) (string, error) {
var err error
var rURL *url.URL
if rURL, err = url.Parse(u); nil != err {
return "", err
}
rURL.Path = path.Join(rURL.Path, p)
return rURL.String(), nil
}