mirror of
https://github.com/thegeeklab/url-parser.git
synced 2024-11-16 10:10:41 +00:00
21 lines
323 B
Go
21 lines
323 B
Go
package command
|
|
|
|
import (
|
|
"net/url"
|
|
"strings"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
"github.com/thegeeklab/url-parser/config"
|
|
)
|
|
|
|
func parseURL(raw string) *url.URL {
|
|
urlString := strings.TrimSpace(raw)
|
|
|
|
url, err := url.Parse(urlString)
|
|
if err != nil {
|
|
log.Fatal().Err(err).Msg(config.ErrParseURL.Error())
|
|
}
|
|
|
|
return url
|
|
}
|