mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-28 22:39:05 +08:00
Remove vcs package since its behaviour diverges from cmd/go.
As stated in the issue https://github.com/golang/go/issues/11490 the package 'vcs' diverges significantly from cmd/go import path resolution behaviour and thus needs to be removed for goreportcard to support modules and versioning. See also: https://golang.org/cl/159818.
This commit is contained in:
committed by
Shawn Smith
parent
d35b037bad
commit
e6fde6c851
@@ -1,24 +1,13 @@
|
||||
package download
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/tools/go/vcs"
|
||||
)
|
||||
|
||||
// Clean trims any URL parts, like the scheme or username, that might be present
|
||||
// in a user-submitted URL
|
||||
func Clean(path string) (string, error) {
|
||||
importPath := trimUsername(trimScheme(path))
|
||||
root, err := vcs.RepoRootForImportPath(importPath, true)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if root != nil && (root.Root == "" || root.Repo == "") {
|
||||
return root.Root, errors.New("empty repo root")
|
||||
}
|
||||
return root.Root, err
|
||||
func Clean(path string) string {
|
||||
return trimUsername(trimScheme(path))
|
||||
}
|
||||
|
||||
// trimScheme removes a scheme (e.g. https://) from the URL for more
|
||||
|
||||
Reference in New Issue
Block a user