Closed autarch closed 1 year ago
go-mode expects a proper gofmt-like command here, and I am not inclined to add a special case for a tool that isn't one and that, depending on the configuration, isn't capable of automatically applying fixes in the first place (golangci/golangci-lint#3230, golangci/golangci-lint#1577, golangci/golangci-lint#1510, golangci/golangci-lint#1726). It's also highly dubious that using just the goimports
check in golangci-lint would disagree with actual goimports.
A formatter that is almost like gofmt but not quite would be gofumpt, but that is a proper drop-in replacement for gofmt and works with the existing gofmt-command setting.
We use
golangci-lint
for linting, including checking that code is formatted properly. It's formatting slightly differs fromgofmt
andgoimports
, so I'd prefer to use it to do formatting. I tried the following in my.emacs
:The problem is that
go-mode
is appending additional arguments like-w
when it calls this command, and this isn't supported bygolangci-lint
.