gofmt return multiple function closures

63 views
Skip to first unread message

Neehar Vijay

unread,
Feb 19, 2021, 9:46:56 AM2/19/21
to golang-nuts
See attachment.

I tried returning two closures from one function, but gofmt formats it oddly.
It looks fine with a tab width of 4 (like go-tour), but it looks hideous with
a tab width of 8.

Is this intentional? Does gofmt assume tab width of 4 or 8?
main.go

Jan Mercl

unread,
Feb 19, 2021, 10:11:12 AM2/19/21
to Neehar Vijay, golang-nuts
On Fri, Feb 19, 2021 at 3:46 PM Neehar Vijay <neeharv...@gmail.com> wrote:

> Is this intentional? Does gofmt assume tab width of 4 or 8?

No.

Does this look better? https://play.golang.org/p/0NnZmegKVAu

Ie. just add a line break between the return values. Gofmt will keep
yout choice.

Wojciech S. Czarnecki

unread,
Feb 19, 2021, 10:20:53 AM2/19/21
to golan...@googlegroups.com
Dnia 2021-02-19, o godz. 05:52:38
Neehar Vijay <neeharv...@gmail.com> napisał(a):

> Does gofmt assume tab width of 4 or 8?

Gofmt uses ascii tab characters.
It is up to readers to set tabs width as they please.

Hope this helps,

--
Wojciech S. Czarnecki
<< ^oo^ >> OHIR-RIPE
Reply all
Reply to author
Forward
0 new messages