This is a proposal for the next version Go.
Currently gofmt formats struct fields to make the field name and type
aligned.
However this may cause extra changes in a commit diff when one field is
added or removed.
What I propose is to use a tab between the field name and type.
It is responsibili
Dnia 2020-01-29, o godz. 09:56:35
Manlio Perillo napisał(a):
> What I propose is to use a tab between the field name and type.
> It is responsibility of the editor or html formatter to align the code.
This ("between") assumes an agreed constant width of the tab representation.
Ie. it will never
I suspect Manlio was referring to something like this
http://nickgravgaard.com/elastic-tabstops/.
Dan
On Thu, 2020-01-30 at 01:10 +0100, Wojciech S. Czarnecki wrote:
> Dnia 2020-01-29, o godz. 09:56:35
> Manlio Perillo napisał(a):
>
> > What I propose is to use a tab between the field name and
Dnia 2020-01-30, o godz. 00:46:05
Dan Kortschak napisał(a):
> I suspect Manlio was referring to something like this
> http://nickgravgaard.com/elastic-tabstops/.
Could be. So a small correction:
s/agreed constant width of the tab/agreed width of the tab/
Where width can be "elastic".
Yes.
In fact I wrote that alignment should be done by the editor, not gofmt.
Manlio Perillo
On Thursday, January 30, 2020 at 1:46:37 AM UTC+1, kortschak wrote:
>
> I suspect Manlio was referring to something like this
> http://nickgravgaard.com/elastic-tabstops/.
>
> Dan
>
> On Thu, 2020-01-
Of course the tab is elastic **only** for a struct fields. gofmt will
continue to format other code normally.
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.
Manlio Perillo
On Thursday, January 30, 2020 at
Code is looked at by more than just your favorite editor. I know some
people who still open up Notepad to do some quick edits. I cat code all the
time. gofmt ensures that every way you look at the code, be it through a
terminal, one or two lines at a time, a web browser, a diff tool, or the
mos
Dnia 2020-01-30, o godz. 05:50:36
Manlio Perillo 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:
On Thursday, January 30, 2020 at 6:18:36 PM UTC+1, ohir wrote:
>
> Dnia 2020-01-30, o godz. 05:50:36
> Manlio Perillo > napisał(a):
>
>
> > [...]
> But it calls for other solution. Namely:
>
> ===
>
> Gofmt should have -u for "unformat" and -g for "format for a git difftool"
> functionalit
I use "diff -ubB foo bar" to compare files where I don't care about
whitespace differences (-b within line, -B for blank lines).
I believe "git diff" supports -b too.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this grou
On Jan 30, 2020, at 8:46 AM, Manlio Perillo wrote:
>
> Yes.
>
> In fact I wrote that alignment should be done by the editor, not gofmt.
In this scenario, the editor needs to understand Go formatting and apply
special formatting to tabs within struct fields? I strongly discourage this.
It will
On Saturday, February 1, 2020 at 12:45:23 AM UTC+1, David Riley wrote:
>
> On Jan 30, 2020, at 8:46 AM, Manlio Perillo > wrote:
> >
> > Yes.
> >
> > In fact I wrote that alignment should be done by the editor, not gofmt.
>
> In this scenario, the editor needs to understand Go formatting and a
On Feb 1, 2020, at 9:00 AM, Manlio Perillo wrote:
>
> On Saturday, February 1, 2020 at 12:45:23 AM UTC+1, David Riley wrote:
>> Please don't do this. Or make it an opt-in. This is not a good change to
>> force on users by default.
>>
>
> You are right, thanks.
> I guess the only possible so
13 matches
Mail list logo