CFMT es una herramienta para envolver los comentarios GO sobre cierta longitud a una nueva línea.
go get -u github.com/alexkohler/cfmt
Nota : CFMT requiere GoFMT.
Similar a otras herramientas anaylsis estáticas GO (como Golint, VET), CFMT se puede invocar con uno o más nombres de archivo, directorios o paquetes nombrados por su ruta de importación. CFMT también es compatible con el ... comodín.
cfmt [flags] files/directories/packages
cfmt solo imprimirá los cambios que realizará, pero no modificará los archivos de entrada. cfmt se enviará a una nueva línea o se unirá a una línea existente según corresponda. Vea lo siguiente antes/después de ejecutar cfmt -m=100 :
Antes
// I am a long comment that is over 100 characters long. I should probably wrap to a new line.Después
// I am a long comment that is over 100 characters long. I should probably wrap
// to a new line.Antes
// I am a long comment that is over 100 characters long. I should probably wrap below to the
// rest of the comment.Después
// I am a long comment that is over 100 characters long. I should probably wrap
// below to the rest of the comment.Antes
//I am a long comment that starts without a space and is over 100 characters long. When I wrap, I should still start without a spaceDespués
//I am a long comment that starts without a space and is over 100 characters
//long. When I wrap, I should still start without a space cfmt ignora los comentarios de bloque ( /* */ ) y comentarios "agrupados" durante una longitud de 10 (es decir, más de 10 líneas consecutivas que comienzan con // ).
¡Solicitud de solicitud de bienvenida!
Si ha disfrutado de CFMT, ¡eche un vistazo a mis otras herramientas estáticas de Anaylsis!