From bdfbcf6f4b4ab53a617ab76f72e8aa28da6067de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 14 Feb 2021 19:24:13 +0100 Subject: modules: Add config option modules.vendorClosest Fixes #8235 Fixes #8242 --- modules/collect.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'modules/collect.go') diff --git a/modules/collect.go b/modules/collect.go index 4de51258b..db79f434e 100644 --- a/modules/collect.go +++ b/modules/collect.go @@ -531,7 +531,16 @@ func (c *collector) collectModulesTXT(owner Module) error { return errors.Errorf("invalid modules list: %q", filename) } path := parts[0] - if _, found := c.vendored[path]; !found { + + shouldAdd := c.Client.moduleConfig.VendorClosest + + if !shouldAdd { + if _, found := c.vendored[path]; !found { + shouldAdd = true + } + } + + if shouldAdd { c.vendored[path] = vendoredModule{ Owner: owner, Dir: filepath.Join(vendorDir, path), -- cgit v1.2.3