| 1 |
// run |
| 2 |
|
| 3 |
// Copyright 2017 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
package main |
| 8 |
|
| 9 |
import ( |
| 10 |
"fmt" |
| 11 |
"os" |
| 12 |
) |
| 13 |
|
| 14 |
var ( |
| 15 |
e interface{} |
| 16 |
s = struct{ a *int }{} |
| 17 |
b = e == s |
| 18 |
) |
| 19 |
|
| 20 |
func test(obj interface{}) { |
| 21 |
if obj != struct{ a *string }{} { |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
var x int |
| 26 |
|
| 27 |
func f() [2]string { |
| 28 |
x++ |
| 29 |
return [2]string{"abc", "def"} |
| 30 |
} |
| 31 |
|
| 32 |
func main() { |
| 33 |
var e interface{} = [2]string{"abc", "def"} |
| 34 |
_ = e == f() |
| 35 |
if x != 1 { |
| 36 |
fmt.Println("x=", x) |
| 37 |
os.Exit(1) |
| 38 |
} |
| 39 |
} |