summaryrefslogtreecommitdiffstats
path: root/commands/server.go
diff options
context:
space:
mode:
authorHyeonGyu Lee <vazrupe@naver.com>2019-08-15 16:33:47 +0900
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-08-15 09:33:47 +0200
commitea9261e856c13c1d4ae05fcca08766d410b4b65c (patch)
tree70c68f81d682dff217848bee8b215369ad4a94ea /commands/server.go
parent37f592980315de1890363d4234274a16567a6da0 (diff)
commands: Make sure the hugo field is always initialized before it's used
Wrap the field to make it accessible after initialization. Fixes #6193
Diffstat (limited to 'commands/server.go')
-rw-r--r--commands/server.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/commands/server.go b/commands/server.go
index ade8da5e8..709181507 100644
--- a/commands/server.go
+++ b/commands/server.go
@@ -244,7 +244,7 @@ func (sc *serverCmd) server(cmd *cobra.Command, args []string) error {
return err
}
- for _, s := range c.hugo.Sites {
+ for _, s := range c.hugo().Sites {
s.RegisterMediaTypes()
}
@@ -303,9 +303,9 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, string, string, erro
publishDir = filepath.Join(publishDir, root)
}
- absPublishDir := f.c.hugo.PathSpec.AbsPathify(publishDir)
+ absPublishDir := f.c.hugo().PathSpec.AbsPathify(publishDir)
- jww.FEEDBACK.Printf("Environment: %q", f.c.hugo.Deps.Site.Hugo().Environment)
+ jww.FEEDBACK.Printf("Environment: %q", f.c.hugo().Deps.Site.Hugo().Environment)
if i == 0 {
if f.s.renderToDisk {
@@ -398,7 +398,7 @@ func removeErrorPrefixFromLog(content string) string {
}
func (c *commandeer) serve(s *serverCmd) error {
- isMultiHost := c.hugo.IsMultihost()
+ isMultiHost := c.hugo().IsMultihost()
var (
baseURLs []string
@@ -406,17 +406,17 @@ func (c *commandeer) serve(s *serverCmd) error {
)
if isMultiHost {
- for _, s := range c.hugo.Sites {
+ for _, s := range c.hugo().Sites {
baseURLs = append(baseURLs, s.BaseURL.String())
roots = append(roots, s.Language().Lang)
}
} else {
- s := c.hugo.Sites[0]
+ s := c.hugo().Sites[0]
baseURLs = []string{s.BaseURL.String()}
roots = []string{""}
}
- templ, err := c.hugo.TextTmpl.Parse("__default_server_error", buildErrorTemplate)
+ templ, err := c.hugo().TextTmpl.Parse("__default_server_error", buildErrorTemplate)
if err != nil {
return err
}