hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit e38e881248b7d20927eab0e56c85732e1acbc45e
parent 0665a3951be6ffc2551ef6664856da4cfccd45fa
Author: Cameron Moore <moorereason@gmail.com>
Date:   Tue, 28 Aug 2018 15:51:44 -0500

hugolib: Simplify some code

Diffstat:
Mhugolib/page.go | 4+---
Mhugolib/page_test.go | 6++----
Mhugolib/pagemeta/page_frontmatter.go | 24+++++++++++-------------
Mhugolib/site_output.go | 2+-
4 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/hugolib/page.go b/hugolib/page.go
@@ -1440,9 +1440,7 @@ func (p *Page) update(frontmatter map[string]interface{}) error {
 					resources = append(resources, cast.ToStringMap(vvv))
 				}
 			case []map[string]interface{}:
-				for _, vvv := range vv {
-					resources = append(resources, vvv)
-				}
+				resources = append(resources, vv...)
 			case []interface{}:
 				for _, vvv := range vv {
 					switch vvvv := vvv.(type) {
diff --git a/hugolib/page_test.go b/hugolib/page_test.go
@@ -580,10 +580,8 @@ func testAllMarkdownEnginesForPages(t *testing.T,
 
 		cfg, fs := newTestCfg()
 
-		if settings != nil {
-			for k, v := range settings {
-				cfg.Set(k, v)
-			}
+		for k, v := range settings {
+			cfg.Set(k, v)
 		}
 
 		contentDir := "content"
diff --git a/hugolib/pagemeta/page_frontmatter.go b/hugolib/pagemeta/page_frontmatter.go
@@ -199,19 +199,17 @@ func newFrontmatterConfig(cfg config.Provider) (frontmatterConfig, error) {
 
 	if cfg.IsSet("frontmatter") {
 		fm := cfg.GetStringMap("frontmatter")
-		if fm != nil {
-			for k, v := range fm {
-				loki := strings.ToLower(k)
-				switch loki {
-				case fmDate:
-					c.date = toLowerSlice(v)
-				case fmPubDate:
-					c.publishDate = toLowerSlice(v)
-				case fmLastmod:
-					c.lastmod = toLowerSlice(v)
-				case fmExpiryDate:
-					c.expiryDate = toLowerSlice(v)
-				}
+		for k, v := range fm {
+			loki := strings.ToLower(k)
+			switch loki {
+			case fmDate:
+				c.date = toLowerSlice(v)
+			case fmPubDate:
+				c.publishDate = toLowerSlice(v)
+			case fmLastmod:
+				c.lastmod = toLowerSlice(v)
+			case fmExpiryDate:
+				c.expiryDate = toLowerSlice(v)
 			}
 		}
 	}
diff --git a/hugolib/site_output.go b/hugolib/site_output.go
@@ -70,7 +70,7 @@ func createSiteOutputFormats(allFormats output.Formats, cfg config.Provider) (ma
 
 	outputs := cfg.GetStringMap("outputs")
 
-	if outputs == nil || len(outputs) == 0 {
+	if len(outputs) == 0 {
 		return outFormats, nil
 	}