diff --git a/net/url/url.go b/net/url/url.go new file mode 100644 index 0000000..0ea04a6 --- /dev/null +++ b/net/url/url.go @@ -0,0 +1,20 @@ +package url + +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 +}