url-parser/command/commands.go

21 lines
323 B
Go
Raw Normal View History

2020-09-21 18:24:51 +00:00
package command
2020-02-02 23:05:18 +00:00
import (
"net/url"
"strings"
2023-12-06 08:14:10 +00:00
"github.com/rs/zerolog/log"
"github.com/thegeeklab/url-parser/config"
2020-02-02 23:05:18 +00:00
)
2020-02-03 11:44:19 +00:00
func parseURL(raw string) *url.URL {
urlString := strings.TrimSpace(raw)
2020-02-02 23:05:18 +00:00
url, err := url.Parse(urlString)
if err != nil {
2023-12-06 08:14:10 +00:00
log.Fatal().Err(err).Msg(config.ErrParseURL.Error())
2020-02-02 23:05:18 +00:00
}
return url
}