Hi Ian, my apologies. I meant LF. I read about it and I understand
that the unix line endings should be \n LF.

Not related to gofmt, but it seems my editor sublime3 (on windows, I
tested on linux too) confused me while editing my main.go. I've got

"default_line_ending": "unix",
However this does not end the 'last line' in the file with a LF as EOL.
So it seems one need to do some form of a workaround with:
ensure_newline_at_eof_on_save: true,

Not very pretty thou as each time you save, it results in a new empty
line added to the file. :(

VIM/cat on the other hand gracefully manages the last line EOL LF
without showing an additional empty line.

I should probably ask in the sublime forum. thank you. will




On Tue, Oct 3, 2017 at 12:20 AM, Ian Lance Taylor <i...@golang.org> wrote:
> On Mon, Oct 2, 2017 at 3:36 AM, William Josefsson
> <towilliamjosefs...@gmail.com> wrote:
>>
>> When I run $ go fmt main.go, I can see that the formatter adds an CR
>> '0a' character at the end. I verify this before and after with
>> hexdump. My editor also can detect the trailing line. Somewhat
>> confusing.
>>
>> Is this expected? I tried to search for this but couldn't find any
>> reason to what may cause this. Pls advice. Thank you, will
>
> You confused me for a minute.  0xa is not CR, it is LF.  gofmt does
> add a trailing newline to a file if the last line ends without an
> end-of-line character.  That is normal behavior for Unix systems.  Are
> you running Windows?
>
> Ian

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to