From 749f73866d342b3d19291711fe8d76a0098d2be0 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sat, 29 Jan 2011 00:05:07 -0800 Subject: [PATCH] gofmt style changes only. --- server/go/blobserver/camlistored.go | 7 +++---- server/go/blobserver/enumerate.go | 8 ++++---- server/go/blobserver/get.go | 8 ++++---- server/go/blobserver/localdisk.go | 1 - server/go/blobserver/preupload.go | 1 - server/go/blobserver/range.go | 8 ++++---- server/go/blobserver/range_test.go | 2 +- server/go/blobserver/upload.go | 9 ++++----- 8 files changed, 20 insertions(+), 24 deletions(-) diff --git a/server/go/blobserver/camlistored.go b/server/go/blobserver/camlistored.go index bd7ef0164..874335710 100644 --- a/server/go/blobserver/camlistored.go +++ b/server/go/blobserver/camlistored.go @@ -22,10 +22,10 @@ var flagRequestLog *bool = flag.Bool("reqlog", false, "Log incoming requests") var blobFetcher blobref.Fetcher func handleCamli(conn http.ResponseWriter, req *http.Request) { - handler := func (conn http.ResponseWriter, req *http.Request) { + handler := func(conn http.ResponseWriter, req *http.Request) { httputil.BadRequestError(conn, fmt.Sprintf("Unsupported path (%s) or method (%s).", - req.URL.Path, req.Method)) + req.URL.Path, req.Method)) } if *flagRequestLog { log.Printf("%s %s", req.Method, req.RawURL) @@ -56,7 +56,7 @@ func handleCamli(conn http.ResponseWriter, req *http.Request) { } func handleRoot(conn http.ResponseWriter, req *http.Request) { - fmt.Fprintf(conn, "This is camlistored, a Camlistore storage daemon.\n"); + fmt.Fprintf(conn, "This is camlistored, a Camlistore storage daemon.\n") } func main() { @@ -69,7 +69,6 @@ func main() { os.Exit(1) } - { fi, err := os.Stat(*flagStorageRoot) if err != nil || !fi.IsDirectory() { diff --git a/server/go/blobserver/enumerate.go b/server/go/blobserver/enumerate.go index d7861bd9c..e74f61331 100644 --- a/server/go/blobserver/enumerate.go +++ b/server/go/blobserver/enumerate.go @@ -81,12 +81,12 @@ func readBlobs(ch chan *blobInfo, blobPrefix, diskRoot, after string, remain *ui continue } } - readBlobs(ch, newBlobPrefix, diskRoot + "/" + name, after, remain) + readBlobs(ch, newBlobPrefix, diskRoot+"/"+name, after, remain) continue } if fi.IsRegular() && strings.HasSuffix(name, ".dat") { - blobName := name[0:len(name)-4] + blobName := name[0 : len(name)-4] if blobName <= after { continue } @@ -118,7 +118,7 @@ func handleEnumerateBlobs(conn http.ResponseWriter, req *http.Request) { fmt.Fprintf(conn, "{\n \"blobs\": [\n") var after string - go readBlobs(ch, "", "", req.FormValue("after"), &limit); + go readBlobs(ch, "", "", req.FormValue("after"), &limit) needsComma := false for bi := range ch { if bi == nil { @@ -129,7 +129,7 @@ func handleEnumerateBlobs(conn http.ResponseWriter, req *http.Request) { break } blobName := bi.BlobRef.String() - if (needsComma) { + if needsComma { fmt.Fprintf(conn, ",\n") } fmt.Fprintf(conn, " {\"blobRef\": \"%s\", \"size\": %d}", diff --git a/server/go/blobserver/get.go b/server/go/blobserver/get.go index 8edc09ff0..d35eeacb8 100644 --- a/server/go/blobserver/get.go +++ b/server/go/blobserver/get.go @@ -40,7 +40,7 @@ func createGetHandler(fetcher blobref.Fetcher) func(http.ResponseWriter, *http.R } const fetchFailureDelayNs = 200e6 // 200 ms -const maxJsonSize = 64 * 1024 // should be enough for everyone +const maxJsonSize = 64 * 1024 // should be enough for everyone func sendUnauthorized(conn http.ResponseWriter) { conn.WriteHeader(http.StatusUnauthorized) @@ -134,15 +134,15 @@ func handleGet(conn http.ResponseWriter, req *http.Request, fetcher blobref.Fetc slurpBytes, err := ioutil.ReadAll(lr) if err != nil { log.Printf("Fetch chain %d of %s failed in slurp: %v", i, br.String(), err) - sendUnauthorized(conn) + sendUnauthorized(conn) return } saught := fetchChain[i+1].String() if bytes.IndexAny(slurpBytes, saught) == -1 { log.Printf("Fetch chain %d of %s failed; no reference to %s", i, br.String(), saught) - sendUnauthorized(conn) - return + sendUnauthorized(conn) + return } } } diff --git a/server/go/blobserver/localdisk.go b/server/go/blobserver/localdisk.go index acc256966..645352929 100644 --- a/server/go/blobserver/localdisk.go +++ b/server/go/blobserver/localdisk.go @@ -62,4 +62,3 @@ func BlobFileName(b *blobref.BlobRef) string { func BlobFromUrlPath(path string) *blobref.BlobRef { return blobref.FromPattern(kGetPutPattern, path) } - diff --git a/server/go/blobserver/preupload.go b/server/go/blobserver/preupload.go index 2f896ea45..9d93962c0 100644 --- a/server/go/blobserver/preupload.go +++ b/server/go/blobserver/preupload.go @@ -87,4 +87,3 @@ func handlePreUpload(conn http.ResponseWriter, req *http.Request) { ret["alreadyHave"] = haveVector.Copy() httputil.ReturnJson(conn, ret) } - diff --git a/server/go/blobserver/range.go b/server/go/blobserver/range.go index c948bab02..e00c9c437 100644 --- a/server/go/blobserver/range.go +++ b/server/go/blobserver/range.go @@ -24,12 +24,12 @@ import ( // Default is {0, -1} to read all of a file. type requestedRange struct { - SkipBytes int64 - LimitBytes int64 // or -1 to read all + SkipBytes int64 + LimitBytes int64 // or -1 to read all } func (rr *requestedRange) IsWholeFile() bool { - return rr.SkipBytes == 0 && rr.LimitBytes == -1; + return rr.SkipBytes == 0 && rr.LimitBytes == -1 } var wholeRange = &requestedRange{0, -1} @@ -47,7 +47,7 @@ func getRequestedRange(req *http.Request) *requestedRange { func getRequestedRangeFromString(rrange string) *requestedRange { matches := rangePattern.FindStringSubmatch(rrange) if len(matches) == 0 { - return wholeRange; + return wholeRange } skipBytes, _ := strconv.Atoi64(matches[1]) lastByteInclusive := int64(-1) diff --git a/server/go/blobserver/range_test.go b/server/go/blobserver/range_test.go index cd646264e..8f80b7e09 100644 --- a/server/go/blobserver/range_test.go +++ b/server/go/blobserver/range_test.go @@ -19,5 +19,5 @@ package main import "testing" func testRange(t *t.Testing) { - + } diff --git a/server/go/blobserver/upload.go b/server/go/blobserver/upload.go index ff8cc2e41..34fbe401e 100644 --- a/server/go/blobserver/upload.go +++ b/server/go/blobserver/upload.go @@ -28,11 +28,11 @@ import ( "log" "mime" "os" - ) +) type receivedBlob struct { - blobRef *blobref.BlobRef - size int64 + blobRef *blobref.BlobRef + size int64 } var flagOpenImages *bool = flag.Bool("showimages", false, "Show images on receiving them with eog.") @@ -130,7 +130,7 @@ func handleMultiPartUpload(conn http.ResponseWriter, req *http.Request) { func commonUploadResponse(req *http.Request) map[string]interface{} { ret := make(map[string]interface{}) - ret["maxUploadSize"] = 2147483647 // 2GB.. *shrug* + ret["maxUploadSize"] = 2147483647 // 2GB.. *shrug* ret["uploadUrlExpirationSeconds"] = 86400 if len(req.Host) > 0 { scheme := "http" // TODO: https @@ -229,4 +229,3 @@ func handlePut(conn http.ResponseWriter, req *http.Request) { fmt.Fprint(conn, "OK") } -