feat: Add golang file formatting (#474)

This commit is contained in:
Polo123456789 2025-06-27 12:11:09 -06:00 committed by GitHub
parent 3cfd9d80bc
commit df3b424830
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -142,5 +142,24 @@ export namespace Format {
}
},
},
{
name: "gofmt",
command: ["gofmt", "-w", "$FILE"],
extensions: [".go"],
async enabled() {
try {
const proc = Bun.spawn({
cmd: ["gofmt", "-h"],
cwd: App.info().path.cwd,
stdout: "ignore",
stderr: "ignore",
})
const exit = await proc.exited
return exit === 0
} catch {
return false
}
},
},
]
}