summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-11-01 16:00:06 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-11-01 16:00:06 -0400
commit9f78b3df5aa2b56bba885ccb7e3068724b81f5ad (patch)
treed27b3dd726dc0aefe422edc64a5518fbceaadf5f
parentd004e380bcbcfcc49da2a23d2da48f4c327aa0ff (diff)
gofmt
-rw-r--r--src/edit/dir.go23
-rw-r--r--src/edit/git.go17
-rw-r--r--src/edit/main.go2
-rw-r--r--src/edit/posthack.go2
-rw-r--r--src/util/fd.go8
5 files changed, 25 insertions, 27 deletions
diff --git a/src/edit/dir.go b/src/edit/dir.go
index c1e7cca..cc99774 100644
--- a/src/edit/dir.go
+++ b/src/edit/dir.go
@@ -2,12 +2,12 @@ package main
import (
"fmt"
- "time"
"io/ioutil"
"net/http"
+ "os/user"
"path"
"strings"
- "os/user"
+ "time"
)
func ServeGit(out http.ResponseWriter, in *http.Request) {
@@ -19,7 +19,6 @@ func ServeGit(out http.ResponseWriter, in *http.Request) {
upath = path.Clean(upath)
upath = upath[1:]
-
errcheck(GitPull())
tree, err := GitLsTree()
errcheck(err)
@@ -30,7 +29,7 @@ func ServeGit(out http.ResponseWriter, in *http.Request) {
return
}
if file.Type == "tree" && !strings.HasSuffix(in.URL.Path, "/") {
- out.Header().Set("Location", path.Base(upath) + "/")
+ out.Header().Set("Location", path.Base(upath)+"/")
out.WriteHeader(http.StatusMovedPermanently)
return
}
@@ -56,10 +55,10 @@ func ServeGit(out http.ResponseWriter, in *http.Request) {
content, err := ioutil.ReadAll(in.Body)
errcheck(err)
edit := Edit{
- UserName: userinfo.Name,
- UserEmail: username+"@edit.team4272.com",
- Time: time.Now(),
- Message: msg+"\n",
+ UserName: userinfo.Name,
+ UserEmail: username + "@edit.team4272.com",
+ Time: time.Now(),
+ Message: msg + "\n",
Files: map[string][]byte{
upath: content,
},
@@ -81,10 +80,10 @@ func ServeGit(out http.ResponseWriter, in *http.Request) {
msg = fmt.Sprintf("web edit: delete %q", upath)
}
edit := Edit{
- UserName: userinfo.Name,
- UserEmail: username+"@edit.team4272.com",
- Time: time.Now(),
- Message: msg+"\n",
+ UserName: userinfo.Name,
+ UserEmail: username + "@edit.team4272.com",
+ Time: time.Now(),
+ Message: msg + "\n",
Files: map[string][]byte{
upath: nil,
},
diff --git a/src/edit/git.go b/src/edit/git.go
index 010c928..183e84c 100644
--- a/src/edit/git.go
+++ b/src/edit/git.go
@@ -1,13 +1,13 @@
package main
import (
- "strconv"
- "io"
"bytes"
+ "errors"
"fmt"
+ "io"
"os/exec"
+ "strconv"
"time"
- "errors"
)
func GitPull() error {
@@ -19,11 +19,11 @@ func GitPush() error {
}
type Edit struct {
- UserName string
+ UserName string
UserEmail string
- Time time.Time
- Message string
- Files map[string][]byte
+ Time time.Time
+ Message string
+ Files map[string][]byte
}
func gitTime(t time.Time) string {
@@ -63,12 +63,11 @@ data %d
if _, err = fmt.Fprintf(w, "D %s\n", filename); err != nil {
return err
}
- }
+ }
}
return nil
}
-
func GitCommit(edit Edit) error {
cmd := exec.Command("git", "fast-import")
pip, err := cmd.StdinPipe()
diff --git a/src/edit/main.go b/src/edit/main.go
index 2a640d0..a7ec7bd 100644
--- a/src/edit/main.go
+++ b/src/edit/main.go
@@ -2,8 +2,8 @@ package main
import (
"net/http"
- "util"
"os"
+ "util"
)
func ServeIndex(out http.ResponseWriter, in *http.Request) {
diff --git a/src/edit/posthack.go b/src/edit/posthack.go
index c190399..062903f 100644
--- a/src/edit/posthack.go
+++ b/src/edit/posthack.go
@@ -3,8 +3,8 @@ package main
import (
"io"
"io/ioutil"
- "strconv"
"net/http"
+ "strconv"
"strings"
)
diff --git a/src/util/fd.go b/src/util/fd.go
index 17c64cd..0c99972 100644
--- a/src/util/fd.go
+++ b/src/util/fd.go
@@ -3,12 +3,12 @@
package util
import (
+ "fmt"
"net"
"os"
+ "strconv"
"strings"
- "fmt"
"sync"
- "strconv"
sd "lukeshu.com/git/go/libsystemd/sd_daemon"
)
@@ -27,7 +27,7 @@ func init() {
}
for i, file := range fromSd {
fds[i+3] = file
- sdFds[file.Name()] = i+3
+ sdFds[file.Name()] = i + 3
}
}
@@ -55,7 +55,7 @@ func FdNameToNum(name string) int {
if ok {
return n
} else if n, err := strconv.Atoi(name); err == nil && n < len(sdFds) {
- return n+3
+ return n + 3
}
}
return -1