gracefull shutdown for unresolvable errors

This commit is contained in:
2025-03-07 21:40:53 +07:00
parent 2fd8b20b77
commit e6f21d1bb2
19 changed files with 181 additions and 133 deletions

View File

@@ -2,6 +2,7 @@ package utils
import (
"bufio"
"log"
"nto_cli/entities"
"os"
"strings"
@@ -12,7 +13,7 @@ func GetStructFields(file *os.File, structName string) []entities.Field {
structFound := false
structFields := []entities.Field{}
var structFields []entities.Field
scanner := bufio.NewScanner(file)
for i := 1; scanner.Scan() && bracketsCount > 0; i++ {
@@ -35,7 +36,7 @@ func GetStructFields(file *os.File, structName string) []entities.Field {
}
if err := scanner.Err(); err != nil {
panic(err)
log.Fatalf("Failed to read file with scanner: %s", err)
}
return structFields
}