mvdan / gofumpt

A stricter gofmt
https://pkg.go.dev/mvdan.cc/gofumpt
BSD 3-Clause "New" or "Revised" License
3.15k stars 110 forks source link

Import grouping vs internal #307

Open kolyshkin opened 4 days ago

kolyshkin commented 4 days ago

When working on the code in https://github.com/golang/go, gofumpt insists on placing imports of packages with internal/ prefix to a separate group. Here's an example:

diff --git a/src/os/os_test.go b/src/os/os_test.go
index 9519aa0fc6..01f7932e4f 100644
--- a/src/os/os_test.go
+++ b/src/os/os_test.go
@@ -9,7 +9,6 @@ import (
        "errors"
        "flag"
        "fmt"
-       "internal/testenv"
        "io"
        "io/fs"
        "log"
@@ -26,6 +25,8 @@ import (
        "testing"
        "testing/fstest"
        "time"
+
+       "internal/testenv"
 )

@ianlancetaylor mentioned that this is not how they want their code to be formatted.

If this is by design, please close.

ianlancetaylor commented 4 days ago

Note that this is a special case for the Go standard library only.