2 files changed,
15 insertions(+),
2 deletions(-)
Author:
Oleksandr Smirnov
olexsmir@gmail.com
Committed at:
2026-02-14 17:43:24 +0200
Authored at:
2026-02-14 17:09:21 +0200
Change ID:
mpolnnrrosvokwrpxxpzpwquszzqsnkv
Parent:
96b3828
M
internal/config/validate.go
路路路 3 3 import ( 4 4 "errors" 5 5 "fmt" 6 + "strings" 6 7 "time" 7 8 ) 8 9 路路路 12 13 if c.Meta.Host == "" { 13 14 // TODO: actually it should be a warning, host only used for go-import tag 14 15 errs = append(errs, errors.New("meta.host is required")) 16 + } 17 + 18 + if strings.HasPrefix(c.Meta.Host, "http") { 19 + errs = append(errs, errors.New("meta.host shouldn't include protocol")) 15 20 } 16 21 17 22 if !isDirExists(c.Repo.Dir) {
M
internal/config/validate_test.go
路路路 42 42 }, 43 43 }, 44 44 { 45 - name: "invalid meta.host", 46 - expected: "meta.host", 45 + name: "not set meta.host", 46 + expected: "meta.host is required", 47 47 c: Config{ 48 + Repo: RepoConfig{Dir: t.TempDir()}, 49 + }, 50 + }, 51 + { 52 + name: "invalid meta.host", 53 + expected: "meta.host shouldn't include protocol", 54 + c: Config{ 55 + Meta: MetaConfig{Host: "https://example.com"}, 48 56 Repo: RepoConfig{Dir: t.TempDir()}, 49 57 }, 50 58 },