Run gofmt on everything for the first time ever!

This commit is contained in:
Solderpunk 2020-06-10 21:31:13 +02:00
parent 3e80488f92
commit b0b18971f4
5 changed files with 79 additions and 80 deletions

View File

@ -65,13 +65,13 @@ func handleSCGI(socket_path string, config Config, URL *url.URL, log *LogEntry,
// Send variables // Send variables
vars := prepareSCGIVariables(config, URL, conn) vars := prepareSCGIVariables(config, URL, conn)
length := 0 length := 0
for key, value := range(vars) { for key, value := range vars {
length += len(key) length += len(key)
length += len(value) length += len(value)
length += 2 length += 2
} }
socket.Write([]byte(strconv.Itoa(length) + ":")) socket.Write([]byte(strconv.Itoa(length) + ":"))
for key, value := range(vars) { for key, value := range vars {
socket.Write([]byte(key + "\x00")) socket.Write([]byte(key + "\x00"))
socket.Write([]byte(value + "\x00")) socket.Write([]byte(value + "\x00"))
} }

View File

@ -5,6 +5,7 @@ import (
"crypto/tls" "crypto/tls"
"errors" "errors"
"fmt" "fmt"
"github.com/BurntSushi/toml"
"io/ioutil" "io/ioutil"
"log" "log"
"mime" "mime"
@ -15,7 +16,6 @@ import (
"regexp" "regexp"
"strings" "strings"
"time" "time"
"github.com/BurntSushi/toml"
) )
func handleGeminiRequest(conn net.Conn, config Config, logEntries chan LogEntry) { func handleGeminiRequest(conn net.Conn, config Config, logEntries chan LogEntry) {
@ -161,7 +161,7 @@ func handleGeminiRequest(conn net.Conn, config Config, logEntries chan LogEntry)
// If this file is executable, get dynamic content // If this file is executable, get dynamic content
if info.Mode().Perm()&0111 == 0111 { if info.Mode().Perm()&0111 == 0111 {
for _, cgiPath := range(config.CGIPaths) { for _, cgiPath := range config.CGIPaths {
inCGIPath, err := regexp.Match(cgiPath, []byte(path)) inCGIPath, err := regexp.Match(cgiPath, []byte(path))
if err == nil && inCGIPath { if err == nil && inCGIPath {
handleCGI(config, path, URL, &log, conn) handleCGI(config, path, URL, &log, conn)
@ -349,4 +349,3 @@ func serveFile(path string, log *LogEntry, conn net.Conn, config Config) {
log.Status = 20 log.Status = 20
conn.Write(contents) conn.Write(contents)
} }