Reformat code with go fmt

git-svn-id: file:///srv/svn/repo/marisa/trunk@31 d6811dac-2434-b64a-9ddc-f563ab233461
This commit is contained in:
dev
2021-10-19 10:20:42 +00:00
parent 6f7e7c7515
commit 57df304b1b

View File

@@ -1,21 +1,21 @@
package main
import (
"fmt"
"encoding/json"
"flag"
"fmt"
"html/template"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"os/user"
"time"
"path"
"syscall"
"strconv"
"path/filepath"
"html/template"
"encoding/json"
"strconv"
"syscall"
"time"
"github.com/dustin/go-humanize"
"gopkg.in/ini.v1"
@@ -97,7 +97,7 @@ func writemeta(filename string, expiry int64) error {
}
if verbose {
log.Printf("Saving metadata for %s in %s", meta.Filename, conf.metapath + "/" + meta.Filename + ".json")
log.Printf("Saving metadata for %s in %s", meta.Filename, conf.metapath+"/"+meta.Filename+".json")
}
f, err := os.Create(conf.metapath + "/" + meta.Filename + ".json")
@@ -196,13 +196,12 @@ func uploaderPost(w http.ResponseWriter, r *http.Request) {
writemeta(tmp.Name(), conf.expiry)
link := conf.baseuri + conf.filectx + filepath.Base(tmp.Name())
links = append(links, link)
}
if (r.PostFormValue("output") == "html") {
data := templatedata{ Links: links }
if r.PostFormValue("output") == "html" {
data := templatedata{Links: links}
servetemplate(w, "/upload.html", data)
return
} else {
@@ -216,16 +215,16 @@ func uploaderGet(w http.ResponseWriter, r *http.Request) {
// r.URL.Path is sanitized regarding "." and ".."
filename := r.URL.Path
if r.URL.Path == "/" || r.URL.Path == "/index.html" {
data := templatedata{ Maxsize: humanize.IBytes(uint64(conf.maxsize))}
data := templatedata{Maxsize: humanize.IBytes(uint64(conf.maxsize))}
servetemplate(w, "/index.html", data)
return
}
if verbose {
log.Printf("Serving file %s", conf.rootdir + filename)
log.Printf("Serving file %s", conf.rootdir+filename)
}
http.ServeFile(w, r, conf.rootdir + filename)
http.ServeFile(w, r, conf.rootdir+filename)
}
func uploader(w http.ResponseWriter, r *http.Request) {
@@ -291,7 +290,7 @@ func main() {
log.Printf("Applied configuration:\n%s", conf)
}
if (conf.chroot != "") {
if conf.chroot != "" {
if verbose {
log.Printf("Changing root to %s", conf.chroot)
}