Skip to content

Commit

Permalink
Update TODO for when to remove sanitizeValue
Browse files Browse the repository at this point in the history
  • Loading branch information
dsnet committed Feb 28, 2018
1 parent 3af367b commit 0c93777
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmp/compare.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,9 @@ func detectRaces(c chan<- reflect.Value, f reflect.Value, vs ...reflect.Value) {
// assuming that T is assignable to R.
// Otherwise, it returns the input value as is.
func sanitizeValue(v reflect.Value, t reflect.Type) reflect.Value {
// TODO(dsnet): Remove this hacky workaround.
// See https://golang.org/issue/22143
// TODO(dsnet): Workaround for reflect bug (https://golang.org/issue/22143).
// The upstream fix landed in Go1.10, so we can remove this when drop support
// for Go1.9 and below.
if v.Kind() == reflect.Interface && v.IsNil() && v.Type() != t {
return reflect.New(t).Elem()
}
Expand Down

0 comments on commit 0c93777

Please sign in to comment.