You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simplified example, where a single click on "Format" highlights the issue: https://play.golang.org/p/M8Yn3NAP6V5
At first I thought this is a bug in gofmt, changing the semantic of my code.
What did you expect to see?
Expected to be able to send channels with receive-only direction through that channel.
What did you see instead?
The "root" channel is made with send-only direction instead, during make, thus making it useless:
./prog.go:9:9: invalid operation: <-chch (receive from send-only type chan<- chan int)
Workaround
Adding parentheses around the inner channel solves the issue:
chch:=make(chan (<-chanint))
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Tried to make channel of channels with receive direction: https://play.golang.org/p/1dR3qhjMF90
Simplified example, where a single click on "Format" highlights the issue: https://play.golang.org/p/M8Yn3NAP6V5
At first I thought this is a bug in gofmt, changing the semantic of my code.
What did you expect to see?
Expected to be able to send channels with receive-only direction through that channel.
What did you see instead?
The "root" channel is made with send-only direction instead, during make, thus making it useless:
Workaround
Adding parentheses around the inner channel solves the issue:
The text was updated successfully, but these errors were encountered: