Closed chrisplo closed 12 months ago
See https://github.com/mvdan/gofumpt/issues/117#issuecomment-813349378. Your module path should contain a dot, otherwise we assume that it's the standard library. An exception is when we are formatting inside a Go module, in which case we know the module path and we group its packages separately. This does not happen when formatting standard input, since it's only files on disk which can be part of a module.
using v0.5.0
import ( ... mymodule/mypackage ... ) gets formatted in a separate block when running like
gofumpt myfile.go
butcat myfile.go
formats differently in both cases the current working directory is the package for mayflie.go and that package is in the same moduleI ran across this with null-ls integration at https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/lua/null-ls/builtins/formatting/gofumpt.lua uses stdin. There it uses stdin with the new file contents (can't use the file argument as the file is the old contents).
using stdin in the uql directory
using filename in the uql directory