Warnings by go vet are just meant to be informational: you are
supposed to have a look to check that you didn't make a mistake, but
you might also have written that on purpose.
Rémy.
Dave.
I know it. But when I've used in my code is because I wanted an extra
line.
What about
fmt.Println("foo")
fmt.Println()
That way each line of output is on its own line in the source -- I find
that quite neat.
--
Martin Geisler
Mercurial links: http://mercurial.ch/
> On Mar 11, 2:09 pm, Martin Geisler <m...@lazybytes.net> wrote:
>> Archos <raul....@sent.com> writes:
>> > "go vet" shows the error "Println call ends with newline" with
>> > fmt.Println("foo\n")
>>
>> > So, should it be changed? to fmt.Printf("foo\n\n")
>>
>> What about
>>
>> fmt.Println("foo")
>> fmt.Println()
>>
>> That way each line of output is on its own line in the source -- I
>> find that quite neat.
>
> That are two calls to a same function so it'll take more time and
> memory; i know it's little but I prefer save it using one only
> function to solve it.
Printing a newline is normally not performance critical, but maybe you
intend to print millions of them?
I can process about 800,000 calls to Println per second when piping the
output to /dev/null. If I show the output in my terminal, I can only
print about 26,000 *lines* per second and it doesn't matter if I use a
single or two Println calls to output them.