3 ms·
off tangent, but I really like that syntax of defining types especially for channels: type Foo(chan<- int) instead of what I usually see type Foo cha
by dickeytk 7y ago
off tangent, but I really like that syntax of defining types especially for channels:
type Foo(chan<- int)
instead of what I usually see
type Foo chan<- int
unfortunately it doesn't appear compatible with gofmt (entirely), which changes it to:
type Foo (chan<- int)
I still think it's a good pattern for channels though. It makes it a lot clearer what the type is especially if you have a slice of channels:
type Foo []chan<- int
vs
type Foo [](chan<- int)