mirror of
https://github.com/thegeeklab/url-parser.git
synced 2024-11-22 13:10:41 +00:00
20 lines
247 B
Go
20 lines
247 B
Go
package commands
|
|
|
|
import (
|
|
"net/url"
|
|
"strings"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func parseURL(raw string) *url.URL {
|
|
urlString := strings.TrimSpace(raw)
|
|
|
|
url, err := url.Parse(urlString)
|
|
if err != nil {
|
|
logrus.Fatal(err)
|
|
}
|
|
|
|
return url
|
|
}
|