🚨 Respect linter

This commit is contained in:
Ada 2024-05-22 03:07:33 +02:00
parent f47bbeaaea
commit 1b5851b615
Signed by: ada
GPG key ID: 6A7F898157C6DE6E
2 changed files with 8 additions and 7 deletions

View file

@ -2,13 +2,13 @@ package git
import ( import (
"errors" "errors"
"git.gnous.eu/ada/spiegel/internal/utils"
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
"io" "io"
"os" "os"
"strings" "strings"
"git.gnous.eu/ada/spiegel/internal/utils"
goGit "github.com/go-git/go-git/v5" goGit "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing/transport/ssh"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
@ -41,7 +41,7 @@ func (c RepoConfig) fullClone() {
Mirror: true, Mirror: true,
} }
if !utils.IsHttpRepo(c.URL) { if !utils.IsHTTPRepo(c.URL) {
key, err := os.ReadFile(c.SSHKey) key, err := os.ReadFile(c.SSHKey)
if err != nil { if err != nil {
logrus.Error(err) logrus.Error(err)
@ -90,7 +90,7 @@ func (c RepoConfig) Update() {
Progress: w, Progress: w,
} }
if !utils.IsHttpRepo(c.URL) { if !utils.IsHTTPRepo(c.URL) {
key, err := os.ReadFile(c.SSHKey) key, err := os.ReadFile(c.SSHKey)
if err != nil { if err != nil {
logrus.Error(err) logrus.Error(err)

View file

@ -1,13 +1,14 @@
package utils package utils
import ( import (
"github.com/sirupsen/logrus"
"regexp" "regexp"
"github.com/sirupsen/logrus"
) )
func IsHttpRepo(url string) bool { func IsHTTPRepo(url string) bool {
regex := "^http.?://.*" regex := "^http.?://.*"
result, err := regexp.Match(regex, []byte(url)) result, err := regexp.MatchString(regex, url)
if err != nil { if err != nil {
logrus.Fatal(err) logrus.Fatal(err)
} }