aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2020-10-21 11:17:48 +0200
committerBjørn Erik Pedersen <[email protected]>2020-10-22 09:09:29 +0200
commitfdfa4a5fe62232f65f1dd8d6fe0c500374228788 (patch)
treeb804e91506a7f3c58690c6fd774b28f95184d5dc /modules
parent8cbe2bbfad6aa4de267921e24e166d4addf47040 (diff)
downloadhugo-fdfa4a5fe62232f65f1dd8d6fe0c500374228788.tar.gz
hugo-fdfa4a5fe62232f65f1dd8d6fe0c500374228788.zip
Allow getJSON errors to be ignored
This change is mostly motivated to get a more stable CI build (we're building the Hugo site there, with Instagram and Twitter shortcodes sometimes failing). Fixes #7866
Diffstat (limited to 'modules')
-rw-r--r--modules/client.go12
-rw-r--r--modules/collect.go10
2 files changed, 11 insertions, 11 deletions
diff --git a/modules/client.go b/modules/client.go
index d71c48f0c..d07483d36 100644
--- a/modules/client.go
+++ b/modules/client.go
@@ -119,7 +119,7 @@ func NewClient(cfg ClientConfig) *Client {
// Client contains most of the API provided by this package.
type Client struct {
fs afero.Fs
- logger *loggers.Logger
+ logger loggers.Logger
noVendor glob.Glob
@@ -329,7 +329,7 @@ func (c *Client) Get(args ...string) error {
}
func (c *Client) get(args ...string) error {
- if err := c.runGo(context.Background(), c.logger.Out, append([]string{"get"}, args...)...); err != nil {
+ if err := c.runGo(context.Background(), c.logger.Out(), append([]string{"get"}, args...)...); err != nil {
errors.Wrapf(err, "failed to get %q", args)
}
return nil
@@ -339,7 +339,7 @@ func (c *Client) get(args ...string) error {
// If path is empty, Go will try to guess.
// If this succeeds, this project will be marked as Go Module.
func (c *Client) Init(path string) error {
- err := c.runGo(context.Background(), c.logger.Out, "mod", "init", path)
+ err := c.runGo(context.Background(), c.logger.Out(), "mod", "init", path)
if err != nil {
return errors.Wrap(err, "failed to init modules")
}
@@ -403,7 +403,7 @@ func (c *Client) Clean(pattern string) error {
}
_, err = hugofs.MakeReadableAndRemoveAllModulePkgDir(c.fs, m.Dir)
if err == nil {
- c.logger.FEEDBACK.Printf("hugo: cleaned module cache for %q", m.Path)
+ c.logger.Printf("hugo: cleaned module cache for %q", m.Path)
}
}
return err
@@ -560,7 +560,7 @@ func (c *Client) runGo(
if strings.Contains(stderr.String(), "invalid version: unknown revision") {
// See https://github.com/gohugoio/hugo/issues/6825
- c.logger.FEEDBACK.Println(`hugo: you need to manually edit go.mod to resolve the unknown revision.`)
+ c.logger.Println(`hugo: you need to manually edit go.mod to resolve the unknown revision.`)
}
_, ok := err.(*exec.ExitError)
@@ -616,7 +616,7 @@ func (c *Client) shouldVendor(path string) bool {
// ClientConfig configures the module Client.
type ClientConfig struct {
Fs afero.Fs
- Logger *loggers.Logger
+ Logger loggers.Logger
// If set, it will be run before we do any duplicate checks for modules
// etc.
diff --git a/modules/collect.go b/modules/collect.go
index 8959572d6..3059d3f99 100644
--- a/modules/collect.go
+++ b/modules/collect.go
@@ -124,11 +124,11 @@ type ModulesConfig struct {
GoModulesFilename string
}
-func (m *ModulesConfig) setActiveMods(logger *loggers.Logger) error {
+func (m *ModulesConfig) setActiveMods(logger loggers.Logger) error {
var activeMods Modules
for _, mod := range m.AllModules {
if !mod.Config().HugoVersion.IsValid() {
- logger.WARN.Printf(`Module %q is not compatible with this Hugo version; run "hugo mod graph" for more information.`, mod.Path())
+ logger.Warnf(`Module %q is not compatible with this Hugo version; run "hugo mod graph" for more information.`, mod.Path())
}
if !mod.Disabled() {
activeMods = append(activeMods, mod)
@@ -140,7 +140,7 @@ func (m *ModulesConfig) setActiveMods(logger *loggers.Logger) error {
return nil
}
-func (m *ModulesConfig) finalize(logger *loggers.Logger) error {
+func (m *ModulesConfig) finalize(logger loggers.Logger) error {
for _, mod := range m.AllModules {
m := mod.(*moduleAdapter)
m.mounts = filterUnwantedMounts(m.mounts)
@@ -422,7 +422,7 @@ func (c *collector) applyThemeConfig(tc *moduleAdapter) error {
}
themeCfg, err = metadecoders.Default.UnmarshalToMap(data, metadecoders.TOML)
if err != nil {
- c.logger.WARN.Printf("Failed to read module config for %q in %q: %s", tc.Path(), themeTOML, err)
+ c.logger.Warnf("Failed to read module config for %q in %q: %s", tc.Path(), themeTOML, err)
} else {
maps.ToLower(themeCfg)
}
@@ -480,7 +480,7 @@ func (c *collector) collect() {
defer c.logger.PrintTimerIfDelayed(time.Now(), "hugo: collected modules")
d := debounce.New(2 * time.Second)
d(func() {
- c.logger.FEEDBACK.Println("hugo: downloading modules …")
+ c.logger.Println("hugo: downloading modules …")
})
defer d(func() {})