🚨 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 (
"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)

View file

@ -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)
}