Given the following code (constraints, slices, and maps are the golang.org/x/exp packages of the same name):
func SortedKeys[K interface {
comparable
constraints.Ordered
}, V any](m map[K]V) []K {
keys := maps.Keys(m)
slices.Sort(keys)
return keys
}
gofumpt@latest (900c61a) reformats this to:
func SortedKeys[K interface {
comparable
constraints.Ordered
}, V any](m map[K]V,
) []K {
keys := maps.Keys(m)
slices.Sort(keys)
return keys
}
which has this diff:
--- a 2022-06-19 16:24:24.237245879 +0000
+++ b 2022-06-19 16:25:48.403318940 +0000
@@ -1,7 +1,8 @@
func SortedKeys[K interface {
comparable
constraints.Ordered
-}, V any](m map[K]V) []K {
+}, V any](m map[K]V,
+) []K {
keys := maps.Keys(m)
slices.Sort(keys)
return keys
I did not expect the function arguments to be split over two lines. I'm only starting to learn generics, so this might however be idiomatic. Please do close this issue if it is invalid.
Given the following code (
constraints,slices, andmapsare thegolang.org/x/exppackages of the same name):gofumpt@latest(900c61a) reformats this to:which has this diff:
I did not expect the function arguments to be split over two lines. I'm only starting to learn generics, so this might however be idiomatic. Please do close this issue if it is invalid.