From 2f57a0975f787e28da007114b39a59f1f8b55523 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 1 Dec 2017 19:18:25 +0900 Subject: [PATCH] ing --- net/url/url.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 net/url/url.go 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 +}