Skip to content

reflect: ChanOf makes "han" types instead of "chan" types #16722

@strickyak

Description

@strickyak
  1. What version of Go are you using (go version)?
    go1.7.linux-amd64
  2. What operating system and processor architecture are you using (go env)?
    GOARCH="amd64"
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
  3. What did you do?
    https://play.golang.org/p/7XOdJWnLVM
  4. What did you expect to see? go1.6.1 says this: [ notice second line says "chan" ]
    < string >
    < chan string >
    < chan int >
  5. What did you see instead? go7.1 says this: [ notice second line says "han" ]
    < string >
    < han string >
    < chan int >

If you change my test so that it says
ch := make(chan string, 3)
instead of
ch := make(chan int, 3)
it fixes the error; apparently reflect.ChanOf() only makes a flawed Type object
if a correct one is not already compiled into the program.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions