Skip to content
Snippets Groups Projects
  • Michael Anthony Knyszek's avatar
    755c18ec
    unique: use TypeFor instead of TypeOf to get type in Make · 755c18ec
    Michael Anthony Knyszek authored
    Currently the first thing Make does it get the abi.Type of its argument,
    and uses abi.TypeOf to do it. However, this has a problem for interface
    types, since the type of the value stored in the interface value will
    bleed through. This is a classic reflection mistake.
    
    Fix this by implementing and using a generic TypeFor which matches
    reflect.TypeFor. This gets the type of the type parameter, which is far
    less ambiguous and error-prone.
    
    Fixes #68990.
    
    Change-Id: Idd8d9a1095ef017e9cd7c7779314f7d4034f01a7
    Reviewed-on: https://go-review.googlesource.com/c/go/+/607355
    
    
    Reviewed-by: default avatarDavid Chase <drchase@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    755c18ec
    History
    unique: use TypeFor instead of TypeOf to get type in Make
    Michael Anthony Knyszek authored
    Currently the first thing Make does it get the abi.Type of its argument,
    and uses abi.TypeOf to do it. However, this has a problem for interface
    types, since the type of the value stored in the interface value will
    bleed through. This is a classic reflection mistake.
    
    Fix this by implementing and using a generic TypeFor which matches
    reflect.TypeFor. This gets the type of the type parameter, which is far
    less ambiguous and error-prone.
    
    Fixes #68990.
    
    Change-Id: Idd8d9a1095ef017e9cd7c7779314f7d4034f01a7
    Reviewed-on: https://go-review.googlesource.com/c/go/+/607355
    
    
    Reviewed-by: default avatarDavid Chase <drchase@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.