This is pretty strange but I noticed that gofumpt was creating unexpected groups in import (...) blocks. I've tracked it down to gofumpt doing the wrong thing when path/filepath is imported (maybe others?). Here's what I'm seeing.
I've seen the following on both v0.3.1 and latest master commit:
[16:42:45]-[~/cloned/mvdan.cc/gofumpt]─[manny@zennix]> git status -s
?? gofumpt_does_not_like_path_filepath
[16:42:47]-[~/cloned/mvdan.cc/gofumpt]─[manny@zennix]> git rev-parse HEAD
b5619f8b06cad833eac1c454a48024599d8f5192
With path/filepath in the imports:
[16:47:18]-[~/cloned/mvdan.cc/gofumpt]─[manny@zennix]> cat gofumpt_does_not_like_path_filepath
package tests_test
import (
"path/filepath"
"time"
"github.com/tinkerbell/tink/pkg/apis/core/v1alpha1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/yaml"
)
[16:47:24]-[~/cloned/mvdan.cc/gofumpt]─[manny@zennix]> ./gofumpt -d gofumpt_does_not_like_path_filepath
diff -u gofumpt_does_not_like_path_filepath.orig gofumpt_does_not_like_path_filepath
--- gofumpt_does_not_like_path_filepath.orig 2022-04-25 16:47:24.556880440 -0400
+++ gofumpt_does_not_like_path_filepath 2022-04-25 16:47:24.556880440 -0400
@@ -3,7 +3,9 @@
import (
"path/filepath"
"time"
+
"github.com/tinkerbell/tink/pkg/apis/core/v1alpha1"
"k8s.io/apimachinery/pkg/types"
+
"sigs.k8s.io/yaml"
)
and now without path/filepath:
[16:47:51]-[~/cloned/mvdan.cc/gofumpt]─[manny@zennix]> cat gofumpt_does_not_like_path_filepath
package tests_test
import (
"time"
"github.com/tinkerbell/tink/pkg/apis/core/v1alpha1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/yaml"
)
[16:47:53]-[~/cloned/mvdan.cc/gofumpt]─[manny@zennix]> ./gofumpt -d gofumpt_does_not_like_path_filepath
diff -u gofumpt_does_not_like_path_filepath.orig gofumpt_does_not_like_path_filepath.go
--- gofumpt_does_not_like_path_filepath.orig 2022-04-25 16:47:53.213097982 -0400
+++ gofumpt_does_not_like_path_filepath 2022-04-25 16:47:53.213097982 -0400
@@ -2,6 +2,7 @@
import (
"time"
+
"github.com/tinkerbell/tink/pkg/apis/core/v1alpha1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/yaml"
git bisect says b7afc71 is the first bad commit. This is the commit where stdlib is separated from other imports. Before this commit all the commits are kept grouped together, but at least handled right.
Still with path/filepath in the imports:
[16:57:13]-[~/cloned/mvdan.cc/gofumpt]─[manny@zennix]> git checkout b7afc715b566b948526ad840fc20d53b642f6b6c
Previous HEAD position was 4bef639 Update README.md
HEAD is now at b7afc71 join all standard library imports
[16:57:15]-[~/cloned/mvdan.cc/gofumpt]─[manny@zennix]> rm gofumpt; go build; ./gofumpt -d gofumpt_does_not_like_path_filepath
diff -u gofumpt_does_not_like_path_filepath.orig gofumpt_does_not_like_path_filepath
--- gofumpt_does_not_like_path_filepath.orig 2022-04-25 16:57:16.125345285 -0400
+++ gofumpt_does_not_like_path_filepath 2022-04-25 16:57:16.125345285 -0400
@@ -5,5 +5,6 @@
"time"
"github.com/tinkerbell/tink/pkg/apis/core/v1alpha1"
"k8s.io/apimachinery/pkg/types"
+
"sigs.k8s.io/yaml"
)
[16:57:23]-[~/cloned/mvdan.cc/gofumpt]─[manny@zennix]> git checkout b7afc715b566b948526ad840fc20d53b642f6b6c~
Previous HEAD position was b7afc71 join all standard library imports
HEAD is now at 4bef639 Update README.md
[16:57:24]-[~/cloned/mvdan.cc/gofumpt]─[manny@zennix]> rm gofumpt; go build; ./gofumpt -d gofumpt_does_not_like_path_filepath
diff -u gofumpt_does_not_like_path_filepath.orig gofumpt_does_not_like_path_filepath
--- gofumpt_does_not_like_path_filepath.orig 2022-04-25 16:57:24.571408753 -0400
+++ gofumpt_does_not_like_path_filepath 2022-04-25 16:57:24.571408753 -0400
@@ -1,9 +1,9 @@
package tests_test
import (
- "path/filepath"
- "time"
"github.com/tinkerbell/tink/pkg/apis/core/v1alpha1"
"k8s.io/apimachinery/pkg/types"
+ "path/filepath"
"sigs.k8s.io/yaml"
+ "time"
)
This is pretty strange but I noticed that gofumpt was creating unexpected groups in
import (...)blocks. I've tracked it down to gofumpt doing the wrong thing whenpath/filepathis imported (maybe others?). Here's what I'm seeing.I've seen the following on both v0.3.1 and latest master commit:
With
path/filepathin the imports:and now without
path/filepath:git bisectsays b7afc71 is the first bad commit. This is the commit where stdlib is separated from other imports. Before this commit all the commits are kept grouped together, but at least handled right.Still with
path/filepathin the imports: