diff options
author | Bjørn Erik Pedersen <[email protected]> | 2017-03-25 14:37:04 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2017-03-27 15:43:56 +0200 |
commit | 15b64d51da48807c5f896f17b33d8c0d054c9461 (patch) | |
tree | b8f585ad5a1741b26540184ec29ec2a26fc4060f /deps | |
parent | 148fedd227b8f4f5af8f72cb6841653140f82dfe (diff) | |
download | hugo-15b64d51da48807c5f896f17b33d8c0d054c9461.tar.gz hugo-15b64d51da48807c5f896f17b33d8c0d054c9461.zip |
all: Propagate baseURL error to the callers
Diffstat (limited to 'deps')
-rw-r--r-- | deps/deps.go | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/deps/deps.go b/deps/deps.go index 3e97ffd93..659f259dd 100644 --- a/deps/deps.go +++ b/deps/deps.go @@ -65,7 +65,7 @@ func (d *Deps) LoadResources() error { return nil } -func New(cfg DepsCfg) *Deps { +func New(cfg DepsCfg) (*Deps, error) { var ( logger = cfg.Logger fs = cfg.Fs @@ -92,26 +92,37 @@ func New(cfg DepsCfg) *Deps { fs = hugofs.NewDefault(cfg.Language) } + ps, err := helpers.NewPathSpec(fs, cfg.Language) + + if err != nil { + return nil, err + } + d := &Deps{ Fs: fs, Log: logger, templateProvider: cfg.TemplateProvider, translationProvider: cfg.TranslationProvider, WithTemplate: cfg.WithTemplate, - PathSpec: helpers.NewPathSpec(fs, cfg.Language), + PathSpec: ps, ContentSpec: helpers.NewContentSpec(cfg.Language), Cfg: cfg.Language, Language: cfg.Language, } - return d + return d, nil } // ForLanguage creates a copy of the Deps with the language dependent // parts switched out. func (d Deps) ForLanguage(l *helpers.Language) (*Deps, error) { + var err error + + d.PathSpec, err = helpers.NewPathSpec(d.Fs, l) + if err != nil { + return nil, err + } - d.PathSpec = helpers.NewPathSpec(d.Fs, l) d.ContentSpec = helpers.NewContentSpec(l) d.Cfg = l d.Language = l |