From 1a7dd9bd692ff9db64cea670fa0feaa79c82706d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 2 Nov 2016 16:11:01 -0400 Subject: gofmt --- src/edit/dir.go | 4 ++-- src/edit/git.go | 10 +++++----- src/edit/views.go | 16 ++++++++-------- src/util/template.go | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/edit/dir.go b/src/edit/dir.go index b9fa170..0cfe514 100644 --- a/src/edit/dir.go +++ b/src/edit/dir.go @@ -29,8 +29,8 @@ func ServeGit(out http.ResponseWriter, in *http.Request) { } if file.Type == "tree" { if !strings.HasSuffix(in.URL.Path, "/") { - out.Header().Set("Location", path.Base(upath)+"/") - out.WriteHeader(http.StatusMovedPermanently) + out.Header().Set("Location", path.Base(upath)+"/") + out.WriteHeader(http.StatusMovedPermanently) return } if !strings.HasSuffix(upath, "/") { diff --git a/src/edit/git.go b/src/edit/git.go index edeb111..715a703 100644 --- a/src/edit/git.go +++ b/src/edit/git.go @@ -105,7 +105,7 @@ var ( func parseGitTreeLine(line []byte) (rname string, rfile GitFile, err error) { // There is probably a better, shorter way of doing this - + // line = mode SP type SP hash SP size TAB name a := bytes.SplitN(line, []byte{' '}, 4) if len(a) != 4 { @@ -139,10 +139,10 @@ func parseGitTreeLine(line []byte) (rname string, rfile GitFile, err error) { rname = string(fname) rfile = GitFile{ - Mode: int32(fmodeN), - Type: string(ftype), - Hash: string(fhash), - Size: fsizeN, + Mode: int32(fmodeN), + Type: string(ftype), + Hash: string(fhash), + Size: fsizeN, } return } diff --git a/src/edit/views.go b/src/edit/views.go index 74d8006..d5ad985 100644 --- a/src/edit/views.go +++ b/src/edit/views.go @@ -1,12 +1,12 @@ package main import ( + "bytes" "io" "mime" - "util" - "bytes" "path" "strings" + "util" ) var ( @@ -15,13 +15,13 @@ var ( tmplViewBlob = util.NewTemplate("got/view_blob.got") tmplModified = util.NewTemplate("got/modified.got") tmplDeleted = util.NewTemplate("got/deleted.got") -) +) func renderPage(w io.Writer, title, head, body string) error { return tmplPage.Execute(w, map[string]string{ "title": title, - "head": head, - "body": body, + "head": head, + "body": body, }) } @@ -42,7 +42,7 @@ func renderViewTree(w io.Writer, upath string, tree GitTree) error { // Component Render var buf bytes.Buffer err := tmplViewTree.Execute(&buf, map[string]interface{}{ - "path": upath, + "path": upath, "files": files, }) if err != nil { @@ -61,8 +61,8 @@ func renderViewBlob(w io.Writer, upath string, file GitFile) error { // Component render var buf bytes.Buffer err = tmplViewBlob.Execute(&buf, map[string]string{ - "path": upath, - "ctype": mime.TypeByExtension(path.Ext(upath)), + "path": upath, + "ctype": mime.TypeByExtension(path.Ext(upath)), "content": string(content), }) if err != nil { diff --git a/src/util/template.go b/src/util/template.go index 3c5bd40..ec5ac18 100644 --- a/src/util/template.go +++ b/src/util/template.go @@ -2,8 +2,8 @@ package util import ( "path" - "text/template" "strings" + "text/template" ) func NewTemplate(filenames ...string) *template.Template { -- cgit v1.2.3