Dnia 2020-01-30, o godz. 05:50:36
Manlio Perillo <manlio.peri...@gmail.com> napisał(a):

> alignment should be done by the editor, not gofmt.

What you just said can be translated to:

        "editors must support Go meaning of tab characters"

> Of course the tab is elastic **only** for a struct fields.

Now it adds:

        "editors must also recognize Go struct fields, because tab is ‘elastic’ 
only there."

Tabs (011) are not "elastic" and never were. A fistful of editors in a few IDEs 
do
this — mostly using plugins. Then source read out of this particular environment
becomes ugly.

> Struct fields are the only block of code that gofmt will align 
> automatically, and the alignment may change is you add
> or remove a field.

Gofmt does align struct fields automatically now.

Your OP calls to abandon this functionality for the sake of some six editors 
that
have "elastictab" plugins. Nonetheless you mentioned that current state make
source control changesets bigger than necessary, and that is a valid point.

But it calls for other solution. Namely: 

===

Gofmt should have -u for "unformat" and -g for "format for a git difftool" 
functionality added.

Called with -u it would produce source with minimal whitespace possible — to be
used in the commit pipeline.

Called with -g on the difftool pipeline it would try to nicely format diff 
chunk.

===
 
> Manlio Perillo

Hope this helps,

-- 
Wojciech S. Czarnecki
 << ^oo^ >> OHIR-RIPE

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/20200130181758.7823d44e%40xmint.

Reply via email to