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

@ -72,10 +72,10 @@ func NewDatabase() *Database {
db := &Database{
codes: make(map[string]*CodeInfo),
}
// Initialize with standard transponder codes
db.loadStandardCodes()
return db
}
@ -107,7 +107,7 @@ func (db *Database) loadStandardCodes() {
Priority: 90,
Notes: "General emergency situation requiring immediate attention",
},
// Standard VFR/IFR Codes
{
Code: "1200",
@ -149,7 +149,7 @@ func (db *Database) loadStandardCodes() {
Priority: 5,
Notes: "Transponder operating but no specific code assigned",
},
// Special Purpose Codes
{
Code: "1255",
@ -175,7 +175,7 @@ func (db *Database) loadStandardCodes() {
Priority: 35,
Notes: "Military interceptor aircraft",
},
// Military Ranges
{
Code: "4000",
@ -193,7 +193,7 @@ func (db *Database) loadStandardCodes() {
Priority: 12,
Notes: "Military interceptor operations (0100-0777 range)",
},
// Additional Common Codes
{
Code: "1201",
@ -219,7 +219,7 @@ func (db *Database) loadStandardCodes() {
Priority: 8,
Notes: "VFR flight above 12,500 feet requiring transponder",
},
// European Specific
{
Code: "7001",
@ -246,7 +246,7 @@ func (db *Database) loadStandardCodes() {
Notes: "General Air Traffic operating in Other Air Traffic area",
},
}
// Add all codes to the database
for _, code := range codes {
db.codes[code.Code] = code
@ -254,7 +254,7 @@ func (db *Database) loadStandardCodes() {
}
// Lookup returns information about a given transponder code
//
//
// The method accepts both 4-digit strings and integers, automatically
// formatting them as needed. Returns nil if the code is not found in the database.
//
@ -308,13 +308,13 @@ func (db *Database) LookupHex(hexCode string) *CodeInfo {
// - []*CodeInfo: Slice of all emergency codes, sorted by priority (highest first)
func (db *Database) GetEmergencyCodes() []*CodeInfo {
var emergencyCodes []*CodeInfo
for _, info := range db.codes {
if info.Type == Emergency {
emergencyCodes = append(emergencyCodes, info)
}
}
// Sort by priority (highest first)
for i := 0; i < len(emergencyCodes); i++ {
for j := i + 1; j < len(emergencyCodes); j++ {
@ -323,7 +323,7 @@ func (db *Database) GetEmergencyCodes() []*CodeInfo {
}
}
}
return emergencyCodes
}
@ -379,7 +379,7 @@ func (db *Database) FormatSquawkWithDescription(code string) string {
if info == nil {
return code // Return just the code if no description available
}
switch info.Type {
case Emergency:
return fmt.Sprintf("%s (⚠️ EMERGENCY - %s)", code, info.Description)
@ -390,4 +390,4 @@ func (db *Database) FormatSquawkWithDescription(code string) string {
default:
return fmt.Sprintf("%s (%s)", code, info.Description)
}
}
}