@@ -106,13 +106,13 @@ func GetReleases(gitURI, forge string) ([]Release, error) {
}
// minimalClone clones a repository with a depth of 1 and no checkout.
-func minimalClone(url string) (r *git.Repository, err error) {
+func minimalClone(url string) (*git.Repository, error) {
path, err := stringifyRepo(url)
if err != nil {
return nil, err
}
- r, err = git.PlainOpen(path)
+ r, err := git.PlainOpen(path)
if err == nil {
err = r.Fetch(&git.FetchOptions{
RemoteName: "origin",
@@ -137,7 +137,7 @@ func minimalClone(url string) (r *git.Repository, err error) {
}
// RemoveRepo removes a repository from the local filesystem.
-func RemoveRepo(url string) (err error) {
+func RemoveRepo(url string) error {
path, err := stringifyRepo(url)
if err != nil {
return err
@@ -168,7 +168,7 @@ func RemoveRepo(url string) (err error) {
// stringifyRepo accepts a repository URI string and the corresponding local
// filesystem path, whether the URI is HTTP, HTTPS, or SSH.
-func stringifyRepo(url string) (path string, err error) {
+func stringifyRepo(url string) (string, error) {
url = strings.TrimSuffix(url, ".git")
url = strings.TrimSuffix(url, "/")
@@ -181,7 +181,6 @@ func stringifyRepo(url string) (path string, err error) {
return "data/" + strings.Split(url, "://")[1], nil
} else if ep.Protocol == "ssh" {
return "data/" + ep.Host + "/" + ep.Path, nil
- } else {
- return "", errors.New("unsupported protocol")
}
+ return "", errors.New("unsupported protocol")
}