2 files changed,
15 insertions(+),
2 deletions(-)
Author:
Oleksandr Smirnov
olexsmir@gmail.com
Committed at:
2026-02-14 17:43:24 +0200
Change ID:
mpolnnrrosvokwrpxxpzpwquszzqsnkv
Parent:
96b3828
M
internal/config/validate.go
@@ -3,6 +3,7 @@
import ( "errors" "fmt" + "strings" "time" )@@ -12,6 +13,10 @@
if c.Meta.Host == "" { // TODO: actually it should be a warning, host only used for go-import tag errs = append(errs, errors.New("meta.host is required")) + } + + if strings.HasPrefix(c.Meta.Host, "http") { + errs = append(errs, errors.New("meta.host shouldn't include protocol")) } if !isDirExists(c.Repo.Dir) {
M
internal/config/validate_test.go
@@ -42,9 +42,17 @@ },
}, }, { - name: "invalid meta.host", - expected: "meta.host", + name: "not set meta.host", + expected: "meta.host is required", c: Config{ + Repo: RepoConfig{Dir: t.TempDir()}, + }, + }, + { + name: "invalid meta.host", + expected: "meta.host shouldn't include protocol", + c: Config{ + Meta: MetaConfig{Host: "https://example.com"}, Repo: RepoConfig{Dir: t.TempDir()}, }, },