fix: corregir argumentos faltantes en fmt.Sprintf y usar net.JoinHostPort

- generateModelFileContent: faltaban 4 args (item Update, Delete comment/func/model)
- generateControllerFileContent: faltaban 2 args (Delete func y mensaje)
- generateRouteFileContent: faltaba 1 arg (comentario Delete)
- servidor_controller: usar net.JoinHostPort para compatibilidad con IPv6

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro GD
2026-07-13 18:19:19 +00:00
co-authored by Claude Sonnet 4.6
parent 9fd0772e91
commit 50812749ea
2 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -393,7 +393,7 @@ func PingConexion(c *fiber.Ctx) error {
}
// Si la BD no conecta, probar al menos TCP (puerto abierto)
tcpAddr := fmt.Sprintf("%s:%s", host, puerto)
tcpAddr := net.JoinHostPort(host, puerto)
inicioTCP := time.Now()
conn, errTCP := net.DialTimeout("tcp", tcpAddr, 3*time.Second)
if errTCP == nil {
+4 -3
View File
@@ -301,7 +301,8 @@ func Delete%s (id uint) error {
title, title, // Modelo usado en la consulta
pluralTitle, pluralTitle, title, // AllSelect sin paginación
title, title, title, // Crear, actualizar, borrar registros
title, title, title, title) // Funciones de creación, actualización y eliminación
title, title, title, title, // func Create, item Create, // Update, func Update
title, title, title, title) // item Update, // Delete, func Delete, &Delete{}
}
// Función para generar el contenido del archivo de controlador
@@ -452,7 +453,7 @@ func Delete%s(c *fiber.Ctx) error {
"error": false,
})
}
`, title, lowerTitle, title, title, title, title, title, title, title, lowerTitle, title, title, lowerTitle, title)
`, title, lowerTitle, title, title, title, title, title, title, title, lowerTitle, title, title, lowerTitle, title, title, lowerTitle)
}
// Función para generar el contenido de rutas para el nuevo submódulo
@@ -467,7 +468,7 @@ func generateRouteFileContent(title string) string {
account.Post("/%s", controllers.Create%s) // Crear un nuevo %s
account.Put("/%s/:id", controllers.Update%s) // Actualizar un %s existente
account.Delete("/%s/:id", controllers.Delete%s) // Eliminar un %s
`, lowerTitle, lowerTitle, title, lowerTitle, lowerTitle, title, lowerTitle, lowerTitle, title, lowerTitle, lowerTitle, title, lowerTitle, lowerTitle, title)
`, lowerTitle, lowerTitle, title, lowerTitle, lowerTitle, title, lowerTitle, lowerTitle, title, lowerTitle, lowerTitle, title, lowerTitle, lowerTitle, title, lowerTitle)
}
// Función para añadir contenido a un archivo existente