style: Apply code formatting with go fmt

- Run 'make format' to ensure all Go code follows standard formatting
- Maintains consistent code style across the entire codebase
- No functional changes, only whitespace and formatting improvements
This commit is contained in:
Ole-Morten Duesund 2025-09-01 10:05:29 +02:00
commit 2bffa2c418
19 changed files with 543 additions and 527 deletions

View file

@ -29,5 +29,6 @@ import "embed"
// external file deployment or complicated asset management.
//
// Updated to include database.html for database status page
//
//go:embed static
var Static embed.FS

View file

@ -458,7 +458,9 @@ func cmdUpdate(db *database.Database, sources []string, force bool) error {
if len(result.Errors) > 0 {
log.Printf(" %d errors occurred during import (first few):", len(result.Errors))
for i, errMsg := range result.Errors {
if i >= 3 { break }
if i >= 3 {
break
}
log.Printf(" %s", errMsg)
}
}
@ -683,4 +685,3 @@ func cmdOptimize(db *database.Database, force bool) error {
fmt.Println("\n✅ Database optimization completed!")
return nil
}

View file

@ -240,7 +240,6 @@ func (db *Database) Health() error {
return db.conn.Ping()
}
// DefaultConfig returns the default database configuration
func DefaultConfig() *Config {
return &Config{

View file

@ -208,10 +208,18 @@ func (dl *DataLoader) loadOpenFlightsAirlines(reader io.Reader, source DataSourc
active := len(record) > 7 && strings.Trim(record[7], `"`) == "Y"
// Convert \N to empty strings
if alias == "\\N" { alias = "" }
if iata == "\\N" { iata = "" }
if icao == "\\N" { icao = "" }
if callsign == "\\N" { callsign = "" }
if alias == "\\N" {
alias = ""
}
if iata == "\\N" {
iata = ""
}
if icao == "\\N" {
icao = ""
}
if callsign == "\\N" {
callsign = ""
}
_, err = insertStmt.Exec(id, name, alias, iata, icao, callsign, country, active, source.Name)
if err != nil {
@ -298,10 +306,18 @@ func (dl *DataLoader) loadOpenFlightsAirports(reader io.Reader, source DataSourc
timezone := strings.Trim(record[11], `"`)
// Convert \N to empty strings
if iata == "\\N" { iata = "" }
if icao == "\\N" { icao = "" }
if dst == "\\N" { dst = "" }
if timezone == "\\N" { timezone = "" }
if iata == "\\N" {
iata = ""
}
if icao == "\\N" {
icao = ""
}
if dst == "\\N" {
dst = ""
}
if timezone == "\\N" {
timezone = ""
}
_, err = insertStmt.Exec(id, name, city, country, iata, icao, lat, lon, alt, tzOffset, dst, timezone, source.Name)
if err != nil {
@ -497,7 +513,6 @@ func (dl *DataLoader) recordDataSource(tx *sql.Tx, source DataSource) error {
return err
}
// ClearDataSource removes all data from a specific source
func (dl *DataLoader) ClearDataSource(sourceName string) error {
tx, err := dl.conn.Begin()

View file

@ -86,7 +86,7 @@ func (om *OptimizationManager) OptimizeDatabase() error {
fmt.Println("Optimizing database for storage efficiency...")
// Apply storage-friendly pragmas
optimizations := []struct{
optimizations := []struct {
name string
query string
description string