Mere humans are incapable of doing this right as most don't run with show whitespace (so tabs and spaces look different) & many don't grok the difference between indentation and alignment.
I wonder if gofmt logic can be extended to other languages.
I wonder if gofmt logic can be extended to other languages.
E.g. I would write
struct Foo {
int bob;
string alice;
};
and not worry about lining up variables, whereas gofmt would give you type Foo struct {
bob int
alice string
}
which is fine too but not worth doing by hand IMO.But if you are, it's not too hard to know where to use spaces and where to use tabs, even w/o show whitespace. But it is true that this is more deeply more than most programmers want to think about indentation. :)