mirror of
https://github.com/sst/opencode.git
synced 2025-09-01 18:57:24 +00:00
feat: Add golang file formatting (#474)
This commit is contained in:
parent
3cfd9d80bc
commit
df3b424830
1 changed files with 19 additions and 0 deletions
|
@ -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
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue