DEV Community

Discussion on: How do I disable GoLang's auto-formatting on file save in VSCode?

Collapse
 
baenencalin profile image
Calin Baenen

I'm now on Arch Linux, it's been a while, and I've tried to come back, NOTHING is overwriting it, and it still doesn't work. The bug is driving me fucking insane! - This is my settings.json:

{
    "security.workspace.trust.untrustedFiles": "open",
    "workbench.editor.untitled.hint": "hidden",

    "editor.trimAutoWhitespace": false,
    "editor.insertSpaces": false,
    "editor.tabSize": 4,

    "go.autocompleteUnimportedPackages": true,
    "go.formatTool": null,
    "go.lintOnSave": "off",
    "[go]": {
        "editor.formatOnSave": false,
        "editor.defaultFormatter": null,
        "editor.codeActionsOnSave": {
            "source.fixAll": false
        }
    }
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
wgumenyuk profile image
Wlad G. Gumenyuk

Adding source.organizeImports: false to editor.codeActionsOnSave fixed it for me!

{
    "[go]": {
        "editor.formatOnSave": false,
        "editor.codeActionsOnSave": {
            "source.fixAll": false,
            "source.organizeImports": false
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

Hope this helps!

Thread Thread
 
vanenshi profile image
Amir Hossein Shekari

Oh Man, you saved my life ♥︎