| 1 |
exec gofumpt foo.go |
| 2 |
cmp stdout foo.go.golden |
| 3 |
|
| 4 |
-- go.mod -- |
| 5 |
module test |
| 6 |
|
| 7 |
go 1.18 |
| 8 |
-- foo.go -- |
| 9 |
package p |
| 10 |
|
| 11 |
func Foo[A, B any](x A, y B) {} |
| 12 |
|
| 13 |
type Vector[T any] []T |
| 14 |
|
| 15 |
var v Vector[int ] |
| 16 |
|
| 17 |
type PredeclaredSignedInteger interface { |
| 18 |
int | int8 | int16 | int32 | int64 |
| 19 |
} |
| 20 |
|
| 21 |
type StringableSignedInteger interface { |
| 22 |
|
| 23 |
~int | ~int8 | ~int16 | ~int32 | ~int64 |
| 24 |
|
| 25 |
String() string |
| 26 |
|
| 27 |
} |
| 28 |
|
| 29 |
type CombineEmbeds interface { |
| 30 |
fmt.Stringer |
| 31 |
comparable | io.Reader |
| 32 |
|
| 33 |
Foo() |
| 34 |
} |
| 35 |
|
| 36 |
func Caller() { |
| 37 |
Foo[int,int](1,2) |
| 38 |
} |
| 39 |
|
| 40 |
func Issue235[K interface { |
| 41 |
comparable |
| 42 |
constraints.Ordered |
| 43 |
}, V any](m map[K]V) []K { |
| 44 |
keys := maps.Keys(m) |
| 45 |
slices.Sort(keys) |
| 46 |
return keys |
| 47 |
} |
| 48 |
|
| 49 |
func multilineParams[V any](p1 V, |
| 50 |
p2 V) { |
| 51 |
|
| 52 |
println("body") |
| 53 |
|
| 54 |
} |
| 55 |
-- foo.go.golden -- |
| 56 |
package p |
| 57 |
|
| 58 |
func Foo[A, B any](x A, y B) {} |
| 59 |
|
| 60 |
type Vector[T any] []T |
| 61 |
|
| 62 |
var v Vector[int] |
| 63 |
|
| 64 |
type PredeclaredSignedInteger interface { |
| 65 |
int | int8 | int16 | int32 | int64 |
| 66 |
} |
| 67 |
|
| 68 |
type StringableSignedInteger interface { |
| 69 |
~int | ~int8 | ~int16 | ~int32 | ~int64 |
| 70 |
|
| 71 |
String() string |
| 72 |
} |
| 73 |
|
| 74 |
type CombineEmbeds interface { |
| 75 |
fmt.Stringer |
| 76 |
comparable | io.Reader |
| 77 |
|
| 78 |
Foo() |
| 79 |
} |
| 80 |
|
| 81 |
func Caller() { |
| 82 |
Foo[int, int](1, 2) |
| 83 |
} |
| 84 |
|
| 85 |
func Issue235[K interface { |
| 86 |
comparable |
| 87 |
constraints.Ordered |
| 88 |
}, V any](m map[K]V) []K { |
| 89 |
keys := maps.Keys(m) |
| 90 |
slices.Sort(keys) |
| 91 |
return keys |
| 92 |
} |
| 93 |
|
| 94 |
func multilineParams[V any](p1 V, |
| 95 |
p2 V, |
| 96 |
) { |
| 97 |
println("body") |
| 98 |
} |