Golang uses tabs not spaces
What version of Codex is running?
codex-cli 0.27.0
Which model were you using?
gpt-5 medium
What platform is your computer?
Linux 6.15.9-arch1-1 x86_64 unknown
What steps can reproduce the bug?
Ask it to write any code in go. It will produce all the code formatted with spaces for indentation instead of tabs. THis goes against the go conventions and causes all the default linters to fail. Codex isnt smart enough to fix the model output using go fmt or gofumt so it wastes a lot of tokens writing the code out the first time using spaces and then re-editing all its changes to turn them back into tabs to make the linters happy.
What is the expected behavior?
Ideally the model should write gocode using spaces and not tabs but failing that codex/the model should know about the standard go lang tooling and use it to fix formatting problems instead of doing it all itself.
What do you see instead?
Spaces instead of tabs
Additional information
_No response_
4 Comments
Does codex have post-edit hooks? Would be easy enough to run
go fmtafter every edit if it has hooks.I would recommend adding an AGENTS.md that tells the model conventions for your codebase. We'll explore hooks, model behavior updates, or something similar in the near future but for now, AGENTS.md should work.
I'm having the same problem with my Godot code repo. I've tried using AGENTS.md. Technically Godot can use spaces too. The problem is that if I go with all spaces, Codex inserts tabs sometimes. When I tried being consistent about tabs, Codex sometimes inserts spaces. Gahhh!!!
I see the issue was closed. That's really a bummer. Relying on AGENTS.md does not work.