Skip to content
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

gofumpt/golines/goimports failed 1/2 #519

Open
nrydanov opened this issue Nov 5, 2024 · 3 comments
Open

gofumpt/golines/goimports failed 1/2 #519

nrydanov opened this issue Nov 5, 2024 · 3 comments

Comments

@nrydanov
Copy link

nrydanov commented Nov 5, 2024

I constantly get messages like gofumpt failed 2 on save.

I see
[Wed Nov 6 00:28:27 2024 582068]  ....living/.local/share/nvim/lazy/go.nvim/lua/go/format.lua:75 |1: { "stat /Users/find.art.in.living/Documents/dev/work/orb/runner/cmd/main.go: no such file or directory" } from stderr in logs.

However, this path exists if I just copy it and open Neovim, for example.

my go.nvim config

return {
    "ray-x/go.nvim",

    event = { "CmdlineEnter" },
    config = function()
        require("go").setup({
            goimports = "golines",
             verbose = true,
                gofmt = "gofumpt",
                log_path = vim.fn.expand("$HOME") .. "/tmp/gonvim.log",
            lsp_cfg = true,
            lsp_inlay_hints = {
                enable = false,
            }
        })

        local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {})
        vim.api.nvim_create_autocmd("BufWritePre", {
            pattern = "*.go",
            callback = function()
                require('go.format').gofmt()
            end,
            group = format_sync_grp,
        })
    end,
    ft = { "go", 'gomod' },
}

@ray-x
Copy link
Owner

ray-x commented Nov 5, 2024

The configuration looks fine. Is the file linked to another file or is it in a cloud shared folder?

@nrydanov
Copy link
Author

nrydanov commented Nov 6, 2024

The configuration looks fine. Is the file linked to another file or is it in a cloud shared folder?

It is existing file on my local drive.

@cl1ckname
Copy link

Same error when using goimports imports option.

[Fri 27 Dec 2024 10:45:27 PM MSK 80466]   ...re/nvim/site/pack/packer/start/go.nvim/lua/go/format.lua:156 |1: imports |2: {}
 |3: goimports
[Fri 27 Dec 2024 10:45:27 PM MSK 80515]   ...re/nvim/site/pack/packer/start/go.nvim/lua/go/format.lua:35 |1: {}
 |2: 2 |3: goimports
[Fri 27 Dec 2024 10:45:27 PM MSK 94510]   ...re/nvim/site/pack/packer/start/go.nvim/lua/go/format.lua:50 |1: formatting buffer... { "/home/username/project/internal/pkg/service/processor/bridge/bridge.go" } |2: 1
[Fri 27 Dec 2024 10:45:27 PM MSK 94557]   ...re/nvim/site/pack/packer/start/go.nvim/lua/go/format.lua:54 |1: fmt cmd: |2: { "goimports", "/home/username/project/internal/pkg/service/processor/bridge/bridge.go" }

[Fri 27 Dec 2024 10:45:27 PM MSK 109606]   ...re/nvim/site/pack/packer/start/go.nvim/lua/go/format.lua:75 |1: { "stat /home/username/project/internal/pkg/service/processor/bridge/bridge.go: no such file or directory" } from stderr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants