-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow gofumports as goimports alternative #2993
Comments
Have you tried setting |
No, because I do need goimports functionality in addition to gofmt/gofumpt.
So it looks like other values are not supported and does not work. |
|
Ah, thanks, @stamblerre ! I'll add proper support for that. |
@stamblerre Cool! Is |
|
What happens when you try? Although setting There are now separate options to configure |
Well, actually it works, thanks! Even setting it to I've also tried to use // before:
package ...
type ...
// after:
package ...
import (
...
)
type ... (@stamblerre Should I report this as separate issue for gopls?) |
I haven't heard reports of this issue before, but you can easily check if it's caused by |
At a glance it looks like there is both an issue with vim-go and gopls (a different ones). Relevant part of vim-go setup: let g:go_fmt_command = 'gopls'
let g:go_imports_autosave = 1
let g:go_imports_mode = 'gopls' $ gopls version
golang.org/x/tools/gopls 0.4.4
golang.org/x/tools/gopls@v0.4.4 h1:8djGYsaZ0ByP0vaXg4T+mnyfDcHpWKSZ+tpQSGv9ahk=
$ cat fmt.go
package main
func F(*testing.T, time.Time) {}
$ gopls imports fmt.go
package main
import (
"testing"
"time"
)
func F(*testing.T, time.Time) {}
$ goimports fmt.go
package main
import (
"testing"
"time"
)
func F(*testing.T, time.Time) {}
$ gofumports fmt.go
package main
import (
"testing"
"time"
)
func F(*testing.T, time.Time) {}
$ vi fmt.go # :wq
$ cat fmt.go
package main
import (
"testing"
"time"
)
func F(*testing.T, time.Time) {} |
@bhcleek Sorry for moving discussion from one issue to another here. Should I close this one and open another about described above |
This isn't the place to talk about gopls bugs generally. I'm leaving this open until #2994 is merged. |
@bhcleek I was talking not about gopls issue (I've already opened golang/go#41225), but about vim-go behaviour for using gopls as fmt/imports, which produces different output to |
Feel free to open a separate issue about using |
https://github.com/mvdan/gofumpt was added to golangci-lint, and it looks reasonable.
Please allow to set
let g:go_fmt_command = 'gofumports'
.Also it may be a good idea to include it into list of installed/updated binaries.
The text was updated successfully, but these errors were encountered: