s/ NewURL/ newURL/g

This commit is contained in:
Songmu 2019-05-01 14:05:29 +09:00
parent 11867e6177
commit c9eeabd030
3 changed files with 7 additions and 7 deletions

View file

@ -170,7 +170,7 @@ func doGet(c *cli.Context) error {
}
}
url, err := NewURL(argURL)
url, err := newURL(argURL)
if err != nil {
return err
}
@ -265,7 +265,7 @@ func doList(c *cli.Context) error {
}
} else {
if hasSchemePattern.MatchString(query) || scpLikeURLPattern.MatchString(query) {
if url, err := NewURL(query); err == nil {
if url, err := newURL(query); err == nil {
if repo, err := LocalRepositoryFromURL(url); err == nil {
query = repo.RelPath
}
@ -357,7 +357,7 @@ func doLook(c *cli.Context) error {
}
if len(reposFound) == 0 {
if url, err := NewURL(name); err == nil {
if url, err := newURL(name); err == nil {
repo, err := LocalRepositoryFromURL(url)
if err != nil {
return err
@ -415,7 +415,7 @@ func doImport(c *cli.Context) error {
}
processLine := func(line string) error {
url, err := NewURL(line)
url, err := newURL(line)
if err != nil {
return fmt.Errorf("Could not parse URL <%s>: %s", line, err)
}

2
url.go
View file

@ -18,7 +18,7 @@ var (
looksLikeAuthorityPattern = regexp.MustCompile(`[A-Za-z0-9]\.[A-Za-z]+(?::\d{1,5})?$`)
)
func NewURL(ref string) (*url.URL, error) {
func newURL(ref string) (*url.URL, error) {
if !hasSchemePattern.MatchString(ref) {
if scpLikeURLPattern.MatchString(ref) {
matched := scpLikeURLPattern.FindStringSubmatch(ref)

View file

@ -62,7 +62,7 @@ func TestNewURL(t *testing.T) {
if tc.setup != nil {
defer tc.setup()()
}
repo, err := NewURL(tc.url)
repo, err := newURL(tc.url)
if err != nil {
t.Errorf("error should be nil but: %s", err)
}
@ -92,7 +92,7 @@ func TestConvertGitURLHTTPToSSH(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.url, func(t *testing.T) {
httpsURL, err := NewURL(tc.url)
httpsURL, err := newURL(tc.url)
if err != nil {
t.Errorf("error should be nil but: %s", err)
}