This is a follow-up of #1017, generalizing the use of reflect.Set method to set, and possibly overwrite, the concrete value of interface objects all accross the implementation of operators. Previous optimized implementation for non-interface objects is preserved.
14 lines
141 B
Go
14 lines
141 B
Go
package main
|
|
|
|
func main() {
|
|
a := true
|
|
var b interface{} = 5
|
|
println(b.(int))
|
|
b = a == true
|
|
println(b.(bool))
|
|
}
|
|
|
|
// Output:
|
|
// 5
|
|
// true
|