* Removed unnecessary string concatenations in Print statements.
authorUrban Wallasch <urban.wallasch@freenet.de>
Sun, 7 Apr 2019 16:15:38 +0000 (18:15 +0200)
committerUrban Wallasch <urban.wallasch@freenet.de>
Sun, 7 Apr 2019 16:15:38 +0000 (18:15 +0200)
* Fixed .footer.goph layout.

config.go
gogopherd.go
samplehole/.footer.goph

index 83c1cc590411c9fe5b0def89bdeeea660dfece28..5e85983022fb783f36d92e025a3f2bef6f710b3f 100644 (file)
--- a/config.go
+++ b/config.go
@@ -44,7 +44,7 @@ var cfg = struct {
 }
 
 func parseConfigFile(filename string) error {
-       tracer.Print("reading config from " + filename)
+       tracer.Print("reading config from ", filename)
        file, err := ioutil.ReadFile(filename)
        if err != nil {
                logger.Print("ReadFile: ", err.Error())
@@ -59,7 +59,7 @@ func parseConfigFile(filename string) error {
                assign := strings.Split(line, "=")
                name := strings.ToLower(strings.TrimSpace(assign[0]))
                val := strings.Trim(strings.TrimSpace(assign[1]), "\"")
-               tracer.Print(name + "=" + val)
+               tracer.Print(name, "=", val)
                switch name {
                case "iface":
                        cfg.iface = val
@@ -82,7 +82,7 @@ func parseConfigFile(filename string) error {
                case "indexes":
                        cfg.indexes = strToBool(val)
                default:
-                       logger.Print("ignoring unknown config item: " + name)
+                       logger.Print("ignoring unknown config item: ", name)
                }
        }
        return nil
@@ -136,7 +136,7 @@ func initialize() {
                cfg.idxpage = ""
        }
 
-       tracer.Print("Version ", version)
+       tracer.Print("Version: ", version)
        tracer.Print("fqdn:    ", cfg.fqdn)
        tracer.Print("iface:   ", cfg.iface)
        tracer.Print("port:    ", cfg.port)
index 2e63a0d489e7831c0e44cbdb598f11af07ae2269..af26bcb73199feb0d9a0c484a83103c08f756296 100644 (file)
@@ -20,7 +20,6 @@ import (
        "net"
        "os"
        "path/filepath"
-       "strconv"
        "strings"
 )
 
@@ -77,7 +76,7 @@ func createIndex(dirname string, selector string) (string, error) {
                                }
                        }
                } else {
-                       logger.Print("unhandled file mode: " + fi.Name() + " (" + fmode.String() + ")")
+                       logger.Print("unhandled file mode: ", fi.Name(), " (", fmode.String(), ")")
                }
        }
        return list, error(nil)
@@ -149,7 +148,7 @@ func sendError(conn net.Conn, msg string) {
        nbytes += int64(nb1)
        nb2, _ := sendFooter(conn)
        nbytes += nb2
-       tracer.Printf("%d bytes sent.", nbytes)
+       tracer.Print(nbytes, " bytes sent.")
        return
 }
 
@@ -204,7 +203,7 @@ func handleRequest(conn net.Conn) {
                        idxpath := path + pathSep + cfg.idxpage
                        nbytes, err = sendFile(conn, idxpath)
                        if err != nil {
-                               tracer.Print("no index file in " + path)
+                               tracer.Print("no index file in ", path)
                        }
                }
                if err != nil {
@@ -230,7 +229,7 @@ func handleRequest(conn net.Conn) {
                sendError(conn, "404")
                return
        }
-       tracer.Print(strconv.FormatInt(nbytes, 10) + " bytes sent.")
+       tracer.Print(nbytes, " bytes sent.")
        return
 }
 
index f03528f039123493c2cce1d997c7e4156960ec0a..a04c2fc2638a7d69daf6883055cede6592eccb15 100644 (file)
@@ -1,3 +1,3 @@
 i      Err     localhost       7070
-i__________________________________________    Err     localhost       7070
+i------------------------------------------    Err     localhost       7070
 iThis page was brought to you by gogopherd.    Err     localhost       7070