Merge pull request #239 from LaPingvino/lint-gofmt

Lint gofmt
diff --git a/gddo-server/assets/templates/pkg.html b/gddo-server/assets/templates/pkg.html
index 176e90b..95a0fc0 100644
--- a/gddo-server/assets/templates/pkg.html
+++ b/gddo-server/assets/templates/pkg.html
@@ -82,7 +82,7 @@
         {{with .AllExamples}}
           <h4 id="pkg-examples">Examples <a class="permalink" href="#pkg-examples">&para;</a></h4>
           <ul class="list-unstyled">
-            {{range . }}<li><a href="#example-{{.Id}}" onclick="$('#ex-{{.Id}}').addClass('in').removeClass('collapse').height('auto')">{{.Label}}</a></li>{{end}}
+            {{range . }}<li><a href="#example-{{.ID}}" onclick="$('#ex-{{.ID}}').addClass('in').removeClass('collapse').height('auto')">{{.Label}}</a></li>{{end}}
           </ul>
         {{else}}
           <span id="pkg-examples"></span>
@@ -173,11 +173,11 @@
   {{if .}}
     <div class="panel-group">
     {{range .}}
-      <div class="panel panel-default" id="example-{{.Id}}">
-        <div class="panel-heading"><a class="accordion-toggle" data-toggle="collapse" href="#ex-{{.Id}}">Example{{with .Example.Name}} ({{.}}){{end}}</a></div>
-        <div id="ex-{{.Id}}" class="panel-collapse collapse"><div class="panel-body">
+      <div class="panel panel-default" id="example-{{.ID}}">
+        <div class="panel-heading"><a class="accordion-toggle" data-toggle="collapse" href="#ex-{{.ID}}">Example{{with .Example.Name}} ({{.}}){{end}}</a></div>
+        <div id="ex-{{.ID}}" class="panel-collapse collapse"><div class="panel-body">
           {{with .Example.Doc}}<p>{{.|comment}}{{end}}
-          <p>Code:{{if .Example.Play}}<span class="pull-right"><a href="?play={{.Id}}">play</a>&nbsp;</span>{{end}}
+          <p>Code:{{if .Example.Play}}<span class="pull-right"><a href="?play={{.ID}}">play</a>&nbsp;</span>{{end}}
           <pre>{{code .Example.Code nil}}</pre>
           {{with .Example.Output}}<p>Output:<pre>{{.}}</pre>{{end}}
         </div></div>
diff --git a/gddo-server/main.go b/gddo-server/main.go
index a0f2cfb..a3c7913 100644
--- a/gddo-server/main.go
+++ b/gddo-server/main.go
@@ -515,7 +515,7 @@
 		prev = pkg.Path + "/"
 		pkgs[j] = pkg
 		rank[j] = rank[i]
-		j += 1
+		j++
 	}
 	pkgs = pkgs[:j]
 
diff --git a/gddo-server/play.go b/gddo-server/play.go
index 02313a4..a957ae1 100644
--- a/gddo-server/play.go
+++ b/gddo-server/play.go
@@ -55,10 +55,10 @@
 	return nil
 }
 
-var exampleIdPat = regexp.MustCompile(`([^-]+)(?:-([^-]*)(?:-(.*))?)?`)
+var exampleIDPat = regexp.MustCompile(`([^-]+)(?:-([^-]*)(?:-(.*))?)?`)
 
 func playURL(pdoc *doc.Package, id string) (string, error) {
-	if m := exampleIdPat.FindStringSubmatch(id); m != nil {
+	if m := exampleIDPat.FindStringSubmatch(id); m != nil {
 		if e := findExample(pdoc, m[1], m[2], m[3]); e != nil && e.Play != "" {
 			resp, err := httpClient.Post("http://play.golang.org/share", "text/plain", strings.NewReader(e.Play))
 			if err != nil {
diff --git a/gddo-server/template.go b/gddo-server/template.go
index bc8b67c..0b23d78 100644
--- a/gddo-server/template.go
+++ b/gddo-server/template.go
@@ -82,7 +82,7 @@
 }
 
 type texample struct {
-	Id      string
+	ID      string
 	Label   string
 	Example *doc.Example
 	obj     interface{}
@@ -123,23 +123,23 @@
 		id += "-" + method
 	}
 	for _, e := range examples {
-		te := &texample{Label: label, Id: id, Example: e, obj: obj}
+		te := &texample{Label: label, ID: id, Example: e, obj: obj}
 		if e.Name != "" {
 			te.Label += " (" + e.Name + ")"
 			if method == "" {
-				te.Id += "-"
+				te.ID += "-"
 			}
-			te.Id += "-" + e.Name
+			te.ID += "-" + e.Name
 		}
 		pdoc.allExamples = append(pdoc.allExamples, te)
 	}
 }
 
-type byExampleId []*texample
+type byExampleID []*texample
 
-func (e byExampleId) Len() int           { return len(e) }
-func (e byExampleId) Less(i, j int) bool { return e[i].Id < e[j].Id }
-func (e byExampleId) Swap(i, j int)      { e[i], e[j] = e[j], e[i] }
+func (e byExampleID) Len() int           { return len(e) }
+func (e byExampleID) Less(i, j int) bool { return e[i].ID < e[j].ID }
+func (e byExampleID) Swap(i, j int)      { e[i], e[j] = e[j], e[i] }
 
 func (pdoc *tdoc) AllExamples() []*texample {
 	if pdoc.allExamples != nil {
@@ -161,7 +161,7 @@
 			}
 		}
 	}
-	sort.Sort(byExampleId(pdoc.allExamples))
+	sort.Sort(byExampleID(pdoc.allExamples))
 	return pdoc.allExamples
 }
 
@@ -239,13 +239,13 @@
 
 func mapFn(kvs ...interface{}) (map[string]interface{}, error) {
 	if len(kvs)%2 != 0 {
-		return nil, errors.New("map requires even number of arguments.")
+		return nil, errors.New("map requires even number of arguments")
 	}
 	m := make(map[string]interface{})
 	for i := 0; i < len(kvs); i += 2 {
 		s, ok := kvs[i].(string)
 		if !ok {
-			return nil, errors.New("even args to map must be strings.")
+			return nil, errors.New("even args to map must be strings")
 		}
 		m[s] = kvs[i+1]
 	}
@@ -430,7 +430,7 @@
 	resp.Header().Set("Content-Type", mimeType)
 	t := templates[name]
 	if t == nil {
-		return fmt.Errorf("Template %s not found", name)
+		return fmt.Errorf("template %s not found", name)
 	}
 	resp.WriteHeader(status)
 	if status == http.StatusNotModified {