mirror of
https://github.com/thegeeklab/url-parser.git
synced 2024-11-16 02:00:45 +00:00
22 lines
338 B
Go
22 lines
338 B
Go
package command
|
|
|
|
import (
|
|
"fmt"
|
|
"net/url"
|
|
"strings"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/thegeeklab/url-parser/config"
|
|
)
|
|
|
|
func parseURL(raw string) *url.URL {
|
|
urlString := strings.TrimSpace(raw)
|
|
|
|
url, err := url.Parse(urlString)
|
|
if err != nil {
|
|
logrus.Fatal(fmt.Errorf("%w: %w", config.ErrParseURL, err))
|
|
}
|
|
|
|
return url
|
|
}
|