This repository has been archived by the owner on Aug 12, 2023. It is now read-only.
goimports-reviser with -rm-unused
removes the module that not in go.mod
#1617
Labels
bug
Something isn't working
FAQ
Issues
Neovim Version
NVIM v0.9.1 Build type: RelWithDebInfo LuaJIT 2.1.0-beta3
Dev Version?
Operating System
Windows 11 10.0.25393
Minimal Config
Steps to Reproduce
Test go file:
glog.Info("World")
into main function"github.com/golang/glog"
after"fmt"
lua vim.lsp.buf.format()
, the"github.com/golang/glog"
disappeared.Reproducibility Check
minimal_init.lua
template and that my issue is reproducible by runningnvim --clean -u minimal_init.lua
and following the steps above.Expected Behavior
Keep the import statement at its place.
Actual Behavior
The import statement disappeared
Debug Log
[TRACE 2023/7/6 23:47:55] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didSave
[TRACE 2023/7/6 23:47:55] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_SAVE
[DEBUG 2023/7/6 23:47:55] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 2023/7/6 23:47:55] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:106: received LSP request for method shutdown
[TRACE 2023/7/6 23:47:55] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method exit
[TRACE 2023/7/6 23:47:57] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/client.lua:97: starting null-ls client
[TRACE 2023/7/6 23:47:57] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:106: received LSP request for method initialize
[DEBUG 2023/7/6 23:47:57] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/client.lua:152: unable to notify client for method textDocument/didOpen (client not active): {
textDocument = {
uri = "file:///R:/code/go/hello-world/main.go"
}
}
[TRACE 2023/7/6 23:47:57] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method initialized
[TRACE 2023/7/6 23:47:57] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didOpen
[TRACE 2023/7/6 23:47:57] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_OPEN
[DEBUG 2023/7/6 23:47:57] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 2023/7/6 23:48:11] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didChange
[TRACE 2023/7/6 23:48:11] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS
[DEBUG 2023/7/6 23:48:11] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 2023/7/6 23:48:12] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didSave
[TRACE 2023/7/6 23:48:12] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_SAVE
[DEBUG 2023/7/6 23:48:12] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 2023/7/6 23:48:16] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didChange
[TRACE 2023/7/6 23:48:16] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS
[DEBUG 2023/7/6 23:48:16] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 2023/7/6 23:48:17] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didChange
[TRACE 2023/7/6 23:48:17] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS
[DEBUG 2023/7/6 23:48:17] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 2023/7/6 23:48:19] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didSave
[TRACE 2023/7/6 23:48:19] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_SAVE
[DEBUG 2023/7/6 23:48:19] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 2023/7/6 23:48:19] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:106: received LSP request for method shutdown
[TRACE 2023/7/6 23:48:19] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method exit
[TRACE 2023/7/6 23:48:20] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/client.lua:97: starting null-ls client
[TRACE 2023/7/6 23:48:20] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:106: received LSP request for method initialize
[DEBUG 2023/7/6 23:48:20] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/client.lua:152: unable to notify client for method textDocument/didOpen (client not active): {
textDocument = {
uri = "file:///R:/code/go/hello-world/main.go"
}
}
[TRACE 2023/7/6 23:48:20] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method initialized
[TRACE 2023/7/6 23:48:20] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didOpen
[TRACE 2023/7/6 23:48:20] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_OPEN
[DEBUG 2023/7/6 23:48:20] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 2023/7/6 23:48:35] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didChange
[TRACE 2023/7/6 23:48:35] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS
[DEBUG 2023/7/6 23:48:35] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 2023/7/6 23:48:43] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:106: received LSP request for method textDocument/formatting
[TRACE 2023/7/6 23:48:43] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_FORMATTING
[DEBUG 2023/7/6 23:48:43] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:321: spawning command "goimports-reviser" at R:\code\go\hello-world with args { "-rm-unused", "R:\code\go\hello-world\.null-ls_814785_main.go" }
[TRACE 2023/7/6 23:48:44] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:205: error output: nil
[TRACE 2023/7/6 23:48:44] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/helpers/generator_factory.lua:206: output: nil
[DEBUG 2023/7/6 23:48:44] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/formatting.lua:89: received edits from generators
[TRACE 2023/7/6 23:48:44] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/formatting.lua:90: {
newText = ')\r\n\r\nfunc main() {\r\n\ts := ""\r\n\tfmt.Println(s)\r\n\tfmt.Printf("test: %s", "hello")\r\n\tglog.Info("Hello")\r\n}\r\n',
range = {
["end"] = {
character = 0,
line = 14
},
start = {
character = 0,
line = 4
}
},
rangeLength = 124
}
[TRACE 2023/7/6 23:48:44] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didChange
[TRACE 2023/7/6 23:48:44] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS
[DEBUG 2023/7/6 23:48:44] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 2023/7/6 23:48:44] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didChange
[TRACE 2023/7/6 23:48:44] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS
[DEBUG 2023/7/6 23:48:44] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE 2023/7/6 23:48:47] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/rpc.lua:131: received LSP notification for method textDocument/didSave
[TRACE 2023/7/6 23:48:47] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_SAVE
[DEBUG 2023/7/6 23:48:47] C:\Users\Jason\AppData\Local\Temp\nvim\site\pack\packer\start\null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
Help
Yes, but I don't know how to start. I would need guidance
Implementation Help
Execute the command in terminal will report a failure message, but doesn't touch the file.
Failure message:
λ goimports-reviser -rm-unused main.go main.go:6:2: no required module provides package github.com/golang/glog; to add it: go get github.com/golang/glog 2023/07/06 23:53:17 Failed to fix file: package has an errors
File contents:
Requirements
The text was updated successfully, but these errors were encountered: