nicely formatted go

i'm kind of a lazy programmer and manually formatting code is suuuch a chore, prettier takes care of that for me in TS and makes my code look, well, pretty.

i've been writing go for a bit now and while gofmt is quite nice they intentionally don't do line wrapping. bummer.

luckily some cool dude out there made golines, "A golang formatter that fixes long lines".

you can emulate a prettier style auto formatting by coupling the Run on Save extension with golines.

go install github.com/segmentio/golines@latest

then open up settings.json & add this:

  "emeraldwalk.runonsave": {
"commands": [
{
"isAsync": true,
"cmd": "[ -f go.mod ] && golines . -w -m 80" // -m max line length
}
]
},

noice.