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
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Milestone

Comments

@nishanths
Copy link

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 commented Nov 20, 2017

/cc @griesemer

@mvdan mvdan added the Suggested Issues that may be good for new contributors looking for work to do. 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 commented Nov 22, 2017

Too late to add new API to Go 1.10.

@dominikh
Copy link
Member

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

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

@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.
Labels
FrozenDueToAge Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests

6 participants