shithub: hugo

Download patch

ref: 72f14a820208b7f371a3bffa0713d44c118a9f17
parent: c274e21356826a6aa1e04d875a37838a6fe1a6c6
author: Bjørn Erik Pedersen <[email protected]>
date: Mon Oct 12 16:47:06 EDT 2015

Apply project wide go fmt

--- a/commands/convert.go
+++ b/commands/convert.go
@@ -33,10 +33,10 @@
 var convertCmd = &cobra.Command{
 	Use:   "convert",
 	Short: "Convert your content to different formats",
-	Long:  `Convert your content (e.g. front matter) to different formats.
+	Long: `Convert your content (e.g. front matter) to different formats.
 
 See convert's subcommands toJSON, toTOML and toYAML for more information.`,
-	Run:   nil,
+	Run: nil,
 }
 
 var toJSONCmd = &cobra.Command{
--- a/commands/list.go
+++ b/commands/list.go
@@ -30,10 +30,10 @@
 var listCmd = &cobra.Command{
 	Use:   "list",
 	Short: "Listing out various types of content",
-	Long:  `Listing out various types of content.
+	Long: `Listing out various types of content.
 
 List requires a subcommand, e.g. ` + "`hugo list drafts`.",
-	Run:   nil,
+	Run: nil,
 }
 
 var listDraftsCmd = &cobra.Command{
@@ -64,7 +64,7 @@
 var listFutureCmd = &cobra.Command{
 	Use:   "future",
 	Short: "List all posts dated in the future",
-	Long:  `List all of the posts in your content directory which will be
+	Long: `List all of the posts in your content directory which will be
 posted in the future.`,
 	Run: func(cmd *cobra.Command, args []string) {
 
--- a/commands/undraft.go
+++ b/commands/undraft.go
@@ -26,10 +26,10 @@
 var undraftCmd = &cobra.Command{
 	Use:   "undraft path/to/content",
 	Short: "Undraft changes the content's draft status from 'True' to 'False'",
-	Long:  `Undraft changes the content's draft status from 'True' to 'False'
+	Long: `Undraft changes the content's draft status from 'True' to 'False'
 and updates the date to the current date and time.
 If the content's draft status is 'False', nothing is done.`,
-	Run:   Undraft,
+	Run: Undraft,
 }
 
 // Publish publishes the specified content by setting its draft status
--- a/helpers/content_renderer.go
+++ b/helpers/content_renderer.go
@@ -4,9 +4,9 @@
 	"bytes"
 	"html"
 
+	"github.com/miekg/mmark"
 	"github.com/russross/blackfriday"
 	"github.com/spf13/viper"
-	"github.com/miekg/mmark"
 )
 
 // Wraps a blackfriday.Renderer, typically a blackfriday.Html
--- a/helpers/content_renderer_test.go
+++ b/helpers/content_renderer_test.go
@@ -1,14 +1,15 @@
 package helpers
+
 import (
-	"testing"
-	"github.com/spf13/viper"
 	"bytes"
+	"github.com/spf13/viper"
+	"testing"
 )
 
 // Renders a codeblock using Blackfriday
 func render(input string) string {
-	ctx := &RenderingContext{};
-	render := GetHTMLRenderer(0, ctx);
+	ctx := &RenderingContext{}
+	render := GetHTMLRenderer(0, ctx)
 
 	buf := &bytes.Buffer{}
 	render.BlockCode(buf, []byte(input), "html")
@@ -17,8 +18,8 @@
 
 // Renders a codeblock using Mmark
 func renderWithMmark(input string) string {
-	ctx := &RenderingContext{};
-	render := GetMmarkHtmlRenderer(0, ctx);
+	ctx := &RenderingContext{}
+	render := GetMmarkHtmlRenderer(0, ctx)
 
 	buf := &bytes.Buffer{}
 	render.BlockCode(buf, []byte(input), "html", []byte(""), false, false)
@@ -25,7 +26,6 @@
 	return buf.String()
 }
 
-
 func TestCodeFence(t *testing.T) {
 
 	if !HasPygments() {
@@ -38,7 +38,7 @@
 		input, expected string
 	}
 	data := []test{
-		{true,  "<html></html>", "<div class=\"highlight\"><pre><span class=\"nt\">&lt;html&gt;&lt;/html&gt;</span>\n</pre></div>\n"},
+		{true, "<html></html>", "<div class=\"highlight\"><pre><span class=\"nt\">&lt;html&gt;&lt;/html&gt;</span>\n</pre></div>\n"},
 		{false, "<html></html>", "<pre><code class=\"language-html\">&lt;html&gt;&lt;/html&gt;</code></pre>\n"},
 	}
 
--- a/helpers/pygments.go
+++ b/helpers/pygments.go
@@ -98,7 +98,7 @@
 	if lang == "" {
 		langOpt = "-g" // Try guessing the language
 	} else {
-		langOpt = "-l"+lang
+		langOpt = "-l" + lang
 	}
 
 	cmd := exec.Command(pygmentsBin, langOpt, "-fhtml", "-O", options)
--- a/tpl/template_funcs.go
+++ b/tpl/template_funcs.go
@@ -83,12 +83,12 @@
 		return nil, errors.New("invalid dict call")
 	}
 	dict := make(map[string]interface{}, len(values)/2)
-	for i := 0; i < len(values); i+=2 {
+	for i := 0; i < len(values); i += 2 {
 		key, ok := values[i].(string)
 		if !ok {
 			return nil, errors.New("dict keys must be strings")
 		}
-	dict[key] = values[i+1]
+		dict[key] = values[i+1]
 	}
 	return dict, nil
 }
--- a/tpl/template_funcs_test.go
+++ b/tpl/template_funcs_test.go
@@ -326,18 +326,18 @@
 
 func TestDictionary(t *testing.T) {
 	for i, this := range []struct {
-		v1     []interface{}
-		expecterr bool
-		expectedValue map[string] interface{}
+		v1            []interface{}
+		expecterr     bool
+		expectedValue map[string]interface{}
 	}{
-		{[]interface{}{"a", "b"}, false, map[string]interface{}{"a":"b"}},
-		{[]interface{}{5, "b"}, true,nil},
-		{[]interface{}{"a", 12,"b",[]int{4}}, false,map[string]interface{}{"a":12,"b":[]int{4}}},
-		{[]interface{}{"a", "b", "c"}, true,nil},
+		{[]interface{}{"a", "b"}, false, map[string]interface{}{"a": "b"}},
+		{[]interface{}{5, "b"}, true, nil},
+		{[]interface{}{"a", 12, "b", []int{4}}, false, map[string]interface{}{"a": 12, "b": []int{4}}},
+		{[]interface{}{"a", "b", "c"}, true, nil},
 	} {
-		r,e := Dictionary(this.v1...)
+		r, e := Dictionary(this.v1...)
 
-		if (this.expecterr && e==nil) || (!this.expecterr && e!=nil)  {
+		if (this.expecterr && e == nil) || (!this.expecterr && e != nil) {
 			t.Errorf("[%d] got an unexpected error", i, e, this.expecterr)
 		} else if !this.expecterr {
 			if !reflect.DeepEqual(r, this.expectedValue) {
@@ -346,7 +346,6 @@
 		}
 	}
 }
-
 
 func TestIn(t *testing.T) {
 	for i, this := range []struct {