Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/ast: define value for the direction of bidirectional channel #22815

Closed
nishanths opened this issue Nov 20, 2017 · 4 comments
Closed

go/ast: define value for the direction of bidirectional channel #22815

nishanths opened this issue Nov 20, 2017 · 4 comments
Assignees
Milestone

Comments

@nishanths
Copy link

@nishanths nishanths commented Nov 20, 2017

The value for the direction of a bidirectional channel isn't defined in the go/ast package [1]. The parser method,(*go/ast.parser).parseChanType, uses ast.SEND | ast.RECV as a substitute.

The proposal is to either:

  1. Declare a constant in package ast: BOTH = SEND | RECV; or
  2. Document in package ast that a bidirectional channel's direction has the value SEND | RECV.

Either option will provide a documented value that clients of package ast can use.

[1] https://tip.golang.org/pkg/go/ast/#ChanDir

@mvdan
Copy link
Member

@mvdan mvdan commented Nov 20, 2017

@mvdan mvdan added the Suggested label Nov 20, 2017
@griesemer griesemer self-assigned this Nov 20, 2017
@griesemer griesemer added this to the Go1.10 milestone Nov 20, 2017
@rsc rsc modified the milestones: Go1.10, Go1.11 Nov 22, 2017
@rsc
Copy link
Contributor

@rsc rsc commented Nov 22, 2017

Too late to add new API to Go 1.10.

@dominikh
Copy link
Member

@dominikh dominikh commented Nov 22, 2017

This should be a simple documentation fix. ChanDir is intended as a bit mask, shown by SEND's and RECV's definition as 1 << iota, but ChanDir's documentation says that "The direction of a channel type is indicated by one of the following constants".

@gopherbot
Copy link

@gopherbot gopherbot commented Nov 29, 2017

Change https://golang.org/cl/80855 mentions this issue: go/ast: improve documentation for channel directions

@gopherbot gopherbot closed this in 98a8e52 Nov 29, 2017
@golang golang locked and limited conversation to collaborators Nov 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.