-
-
Notifications
You must be signed in to change notification settings - Fork 120
Description
I'm sure the default settings work for many, but when looking at this tool, it doesn't let you set a local
prefix, like goimports
does. As such, I am looking for a way to use goimports
in conjunction with gofumpt
.
I set them both up as file watchers in GoLand, but the issue there is that goimports
is much faster, and always finishes first. Which makes the file's imports nice for a second. Then gofumpt
finishes, and undoes all the imports sorting done by goimports
, with it's mangled version.
So for example, goimports -local abc -w $FilePath
formats like this:
import (
"net/http"
"abc"
"abc/xyz"
"github.com/external/package"
)
gofumpt
formats it like this:
import (
"abc"
"abc/xyz"
"net/http"
"github.com/external/package"
)
So is there a way to skip the imports sorting entirely, and leave that to goimports
? If not, and if it's doable, I would appreciate pointers as to how to get that done!
Ideally this just passes on the local
arg to goimports
, which might solve the issue of overwriting as well. Even if this didn't touch the imports block at all, I'm not entirely sure if the conflicting finish times would be an issue or not still.
PS I love the tool, and have been manually enforcing a few of the rules already, and agree with most of the other rules. Just a shame it's incompatible with how the project currently formats imports, or we would be using it already :)