summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-11-02 16:11:01 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-11-02 16:11:01 -0400
commit1a7dd9bd692ff9db64cea670fa0feaa79c82706d (patch)
tree96ddc744a323c97deab92fa8f82a0b62cde89547
parentade49d8845e044292da64fcbe72a1f7ee91e66d9 (diff)
gofmt
-rw-r--r--src/edit/dir.go4
-rw-r--r--src/edit/git.go10
-rw-r--r--src/edit/views.go16
-rw-r--r--src/util/template.go2
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 {