diff options
| author | Polo123456789 <[email protected]> | 2025-06-27 12:11:09 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-27 14:11:09 -0400 |
| commit | df3b4248302f708cee136be5dc9f4c6bee6ac193 (patch) | |
| tree | 51541e41e6d03fe86a4f2ef642374294127a1823 | |
| parent | 3cfd9d80bc7b720f2bb14d153ce8b196e6996f25 (diff) | |
| download | opencode-df3b4248302f708cee136be5dc9f4c6bee6ac193.tar.gz opencode-df3b4248302f708cee136be5dc9f4c6bee6ac193.zip | |
feat: Add golang file formatting (#474)
| -rw-r--r-- | packages/opencode/src/format/index.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/packages/opencode/src/format/index.ts b/packages/opencode/src/format/index.ts index 5ce27bc4e..2a189380b 100644 --- a/packages/opencode/src/format/index.ts +++ b/packages/opencode/src/format/index.ts @@ -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 + } + }, + }, ] } |
