Go: reflect: ChanOf makes "han" types instead of "chan" types

Created on 16 Aug 2016  路  2Comments  路  Source: golang/go

  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.

FrozenDueToAge

Most helpful comment

hank you for the bug report.

All 2 comments

hank you for the bug report.

CL https://golang.org/cl/27119 mentions this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

natefinch picture natefinch  路  3Comments

michaelsafyan picture michaelsafyan  路  3Comments

OneOfOne picture OneOfOne  路  3Comments

jayhuang75 picture jayhuang75  路  3Comments

bbodenmiller picture bbodenmiller  路  3Comments