From 3c2181232e1774bd6c003d4d1de40488cf985faf Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 7 Jan 2019 16:12:06 -0800 Subject: [PATCH] Force line-based files to have valid "Maintainers" too This copies the exact `mainfest.Global.Maintainers` validation from `rfc2822.go`. --- manifest/line-based.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/manifest/line-based.go b/manifest/line-based.go index ca51e3f..498d58a 100644 --- a/manifest/line-based.go +++ b/manifest/line-based.go @@ -80,5 +80,12 @@ func ParseLineBased(readerIn io.Reader) (*Manifest2822, error) { } } + if len(manifest.Global.Maintainers) < 1 { + return nil, fmt.Errorf("missing Maintainers") + } + if invalidMaintainers := manifest.Global.InvalidMaintainers(); len(invalidMaintainers) > 0 { + return nil, fmt.Errorf("invalid Maintainers: %q (expected format %q)", strings.Join(invalidMaintainers, ", "), MaintainersFormat) + } + return manifest, nil }