modules: Throw an error running hugo mod vendor on mountless module

This commit is contained in:
Bjørn Erik Pedersen 2021-02-15 10:47:32 +01:00
parent bf55afd71f
commit 4ffaeaf155
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -237,6 +237,12 @@ func (c *Client) Vendor() error {
continue continue
} }
// See https://github.com/gohugoio/hugo/issues/8239
// This is an error situation. We need something to vendor.
if t.Mounts() == nil {
return errors.Errorf("cannot vendor module %q, need at least one mount", t.Path())
}
fmt.Fprintln(&modulesContent, "# "+t.Path()+" "+t.Version()) fmt.Fprintln(&modulesContent, "# "+t.Path()+" "+t.Version())
dir := t.Dir() dir := t.Dir()