1
1
Fork 0
mirror of https://tildegit.org/solderpunk/molly-brown synced 2024-05-23 04:56:03 +02:00

Big ol' gofmt.

This commit is contained in:
Solderpunk 2023-02-10 17:19:21 +01:00
parent 56d8dde14a
commit 5258b29c6b
4 changed files with 43 additions and 43 deletions

View File

@ -2,11 +2,11 @@ package main
import ( import (
"errors" "errors"
"github.com/BurntSushi/toml"
"log" "log"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"github.com/BurntSushi/toml"
) )
type Config struct { type Config struct {
@ -93,7 +93,7 @@ func getConfig(filename string) (Config, error) {
} }
// Absolutise DocBase // Absolutise DocBase
if(!filepath.IsAbs(config.DocBase)) { if !filepath.IsAbs(config.DocBase) {
abs, err := filepath.Abs(config.DocBase) abs, err := filepath.Abs(config.DocBase)
if err != nil { if err != nil {
return config, err return config, err
@ -103,7 +103,7 @@ func getConfig(filename string) (Config, error) {
// Absolutise CGI paths // Absolutise CGI paths
for index, cgiPath := range config.CGIPaths { for index, cgiPath := range config.CGIPaths {
if(!filepath.IsAbs(cgiPath)) { if !filepath.IsAbs(cgiPath) {
config.CGIPaths[index] = filepath.Join(config.DocBase, cgiPath) config.CGIPaths[index] = filepath.Join(config.DocBase, cgiPath)
} }
} }
@ -121,7 +121,7 @@ func getConfig(filename string) (Config, error) {
// Absolutise SCGI paths // Absolutise SCGI paths
for index, scgiPath := range config.SCGIPaths { for index, scgiPath := range config.SCGIPaths {
if(!filepath.IsAbs(scgiPath)) { if !filepath.IsAbs(scgiPath) {
config.SCGIPaths[index] = filepath.Join(config.DocBase, scgiPath) config.SCGIPaths[index] = filepath.Join(config.DocBase, scgiPath)
} }
} }

View File

@ -51,7 +51,7 @@ func generateDirectoryListing(URL *url.URL, path string, config Config) (string,
return false // Should not happen return false // Should not happen
}) })
// Sort directories before file // Sort directories before file
if(config.DirectorySubdirsFirst) { if config.DirectorySubdirsFirst {
sort.SliceStable(files, func(i, j int) bool { sort.SliceStable(files, func(i, j int) bool {
// If i is a dir and j is a file, i < j // If i is a dir and j is a file, i < j
if files[i].IsDir() && !files[j].IsDir() { if files[i].IsDir() && !files[j].IsDir() {