From 1b5851b615a529723ae36d4e80ecfb7ef96af946 Mon Sep 17 00:00:00 2001 From: Ada Date: Wed, 22 May 2024 03:07:33 +0200 Subject: [PATCH] :rotating_light: Respect linter --- internal/git/clone.go | 8 ++++---- internal/utils/utils.go | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/git/clone.go b/internal/git/clone.go index d3a0a4c..8a618f4 100644 --- a/internal/git/clone.go +++ b/internal/git/clone.go @@ -2,13 +2,13 @@ package git import ( "errors" - "git.gnous.eu/ada/spiegel/internal/utils" - "github.com/go-git/go-git/v5/plumbing/transport/ssh" "io" "os" "strings" + "git.gnous.eu/ada/spiegel/internal/utils" goGit "github.com/go-git/go-git/v5" + "github.com/go-git/go-git/v5/plumbing/transport/ssh" "github.com/sirupsen/logrus" ) @@ -41,7 +41,7 @@ func (c RepoConfig) fullClone() { Mirror: true, } - if !utils.IsHttpRepo(c.URL) { + if !utils.IsHTTPRepo(c.URL) { key, err := os.ReadFile(c.SSHKey) if err != nil { logrus.Error(err) @@ -90,7 +90,7 @@ func (c RepoConfig) Update() { Progress: w, } - if !utils.IsHttpRepo(c.URL) { + if !utils.IsHTTPRepo(c.URL) { key, err := os.ReadFile(c.SSHKey) if err != nil { logrus.Error(err) diff --git a/internal/utils/utils.go b/internal/utils/utils.go index c5da160..7ab72b6 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -1,13 +1,14 @@ package utils import ( - "github.com/sirupsen/logrus" "regexp" + + "github.com/sirupsen/logrus" ) -func IsHttpRepo(url string) bool { +func IsHTTPRepo(url string) bool { regex := "^http.?://.*" - result, err := regexp.Match(regex, []byte(url)) + result, err := regexp.MatchString(regex, url) if err != nil { logrus.Fatal(err) }