| 1 | package p |
| 2 | |
| 3 | // old |
| 4 | type u1 int |
| 5 | |
| 6 | // both |
| 7 | type A int |
| 8 | type u2 int |
| 9 | |
| 10 | // simple type changes |
| 11 | // old |
| 12 | var ( |
| 13 | V1 string |
| 14 | V3 A |
| 15 | V7 <-chan int |
| 16 | ) |
| 17 | |
| 18 | // new |
| 19 | var ( |
| 20 | // i V1: changed from string to []string |
| 21 | V1 []string |
| 22 | V3 A // OK: same |
| 23 | // i V7: changed from <-chan int to chan int |
| 24 | V7 chan int |
| 25 | ) |
| 26 | |
| 27 | // interface type changes |
| 28 | // old |
| 29 | var ( |
| 30 | V9 interface{ M() } |
| 31 | V10 interface{ M() } |
| 32 | V11 interface{ M() } |
| 33 | ) |
| 34 | |
| 35 | // new |
| 36 | var ( |
| 37 | // i V9: changed from interface{M()} to interface{} |
| 38 | V9 interface{} |
| 39 | // i V10: changed from interface{M()} to interface{M(); M2()} |
| 40 | V10 interface { |
| 41 | M2() |
| 42 | M() |
| 43 | } |
| 44 | // i V11: changed from interface{M()} to interface{M(int)} |
| 45 | V11 interface{ M(int) } |
| 46 | ) |
| 47 | |
| 48 | // struct type changes |
| 49 | // old |
| 50 | var ( |
| 51 | VS1 struct{ A, B int } |
| 52 | VS2 struct{ A, B int } |
| 53 | VS3 struct{ A, B int } |
| 54 | VS4 struct { |
| 55 | A int |
| 56 | u1 |
| 57 | } |
| 58 | ) |
| 59 | |
| 60 | // new |
| 61 | var ( |
| 62 | // i VS1: changed from struct{A int; B int} to struct{B int; A int} |
| 63 | VS1 struct{ B, A int } |
| 64 | // i VS2: changed from struct{A int; B int} to struct{A int} |
| 65 | VS2 struct{ A int } |
| 66 | // i VS3: changed from struct{A int; B int} to struct{A int; B int; C int} |
| 67 | VS3 struct{ A, B, C int } |
| 68 | VS4 struct { |
| 69 | A int |
| 70 | u2 |
| 71 | } |
| 72 | ) |