Closed nfort closed 2 weeks ago
Could you send me you config and what OS you are using? Also is the issue reproducible with https://github.com/ray-x/go.nvim/blob/master/playground/init_lazy.lua
OS: Linux x1carbon 6.8.11-300.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 27 14:53:33 UTC 2024 x86_64 GNU/Linux
i use default configs for AstroNvim by community https://github.com/AstroNvim/astrocommunity/blob/main/lua/astrocommunity/pack/go/init.lua
{
"AstroNvim/astrolsp",
optional = true,
---@type AstroLSPOpts
opts = {
---@diagnostic disable-next-line: missing-fields
config = {
gopls = {
settings = {
gopls = {
analyses = {
ST1003 = true,
fieldalignment = false,
fillreturns = true,
nilness = true,
nonewvars = true,
shadow = true,
undeclaredname = true,
unreachable = true,
unusedparams = true,
unusedwrite = true,
useany = true,
},
codelenses = {
gc_details = true, -- Show a code lens toggling the display of gc's choices.
generate = true, -- show the `go generate` lens.
regenerate_cgo = true,
test = true,
tidy = true,
upgrade_dependency = true,
vendor = true,
},
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
buildFlags = { "-tags", "integration" },
completeUnimported = true,
diagnosticsDelay = "500ms",
matcher = "Fuzzy",
semanticTokens = true,
staticcheck = true,
symbolMatcher = "fuzzy",
usePlaceholders = true,
},
},
},
},
},
},
-- Golang support
{
"nvim-treesitter/nvim-treesitter",
optional = true,
opts = function(_, opts)
if opts.ensure_installed ~= "all" then
opts.ensure_installed =
require("astrocore").list_insert_unique(opts.ensure_installed, { "go", "gomod", "gosum", "gowork" })
end
end,
},
{
"jay-babu/mason-null-ls.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(
opts.ensure_installed,
{ "gomodifytags", "gofumpt", "iferr", "impl", "goimports" }
)
end,
},
{
"williamboman/mason-lspconfig.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "gopls" })
end,
},
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(
opts.ensure_installed,
{ "delve", "gopls", "gomodifytags", "gofumpt", "iferr", "impl", "goimports" }
)
end,
},
{
"leoluz/nvim-dap-go",
ft = "go",
dependencies = {
"mfussenegger/nvim-dap",
{
"jay-babu/mason-nvim-dap.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "delve" })
end,
},
},
opts = {},
},
{
"ray-x/go.nvim",
dependencies = {
"ray-x/guihua.lua",
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
},
opts = {
disable_defaults = true,
diagnostic = false,
},
event = { "CmdlineEnter" },
ft = { "go", "gomod" },
-- Prevents Neovim from freezing on plugin installation/update.
-- See: <https://github.com/ray-x/go.nvim/issues/433>
build = function() require("go.install").update_all() end,
},
{
"nvim-neotest/neotest",
optional = true,
dependencies = { "nvim-neotest/neotest-go" },
opts = function(_, opts)
if not opts.adapters then opts.adapters = {} end
table.insert(opts.adapters, require "neotest-go"(require("astrocore").plugin_opts "neotest-go"))
end,
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
go = { "goimports", "gofumpt" },
},
},
},
}
full installed packages list
-- AstroCommunity: import any community modules here
-- We import this file in `lazy_setup.lua` before the `plugins/` folder.
-- This guarantees that the specs are processed before any user plugins.
---@type LazySpec
return {
"AstroNvim/astrocommunity",
{ import = "astrocommunity.colorscheme.catppuccin" },
{ import = "astrocommunity.pack.lua" },
{ import = "astrocommunity.pack.html-css" },
{ import = "astrocommunity.pack.tailwindcss" },
{ import = "astrocommunity.pack.typescript" },
{ import = "astrocommunity.pack.go" },
{ import = "astrocommunity.test.neotest" },
{ import = "astrocommunity.editing-support.multicursors-nvim" },
{ import = "astrocommunity.motion.nvim-surround" },
{ import = "astrocommunity.utility.noice-nvim" },
-- import/override with your plugins folder
}
Also is the issue reproducible with https://github.com/ray-x/go.nvim/blob/master/playground/init_lazy.lua
Yes
{
'ray-x/go.nvim',
dev = (plugin_folder() ~= ''),
-- dev = true,
ft = { 'go', 'gomod', 'gosum', 'gotmpl', 'gohtmltmpl', 'gotexttmpl' },
dependencies = {
'mfussenegger/nvim-dap', -- Debug Adapter Protocol
'rcarriga/nvim-dap-ui',
'nvim-neotest/nvim-nio',
'theHamsta/nvim-dap-virtual-text',
'ray-x/guihua.lua',
},
config = true,
opts = {
disable_defaults = true,
diagnostic = false,
},
}
You have little type in README.md for playground
cd sampleApp
nvim -u ../init.lua main.go
should be
cd sampleApp
nvim -u ../init_lazy.lua main.go
Just confirmed the current master branch that GoRun
is not working as expected as go run .
NVIM:
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1716656478
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/opt/homebrew/Cellar/neovim/0.10.0/share/nvim"
OS:
Darwin Kernel Version 23.5.0: Wed May 1 20:19:05 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8112 arm64
Recorded reproduce: https://asciinema.org/a/0FSxT7cDsE4vbInwD6RoJLOVv Fixed playground README: https://github.com/ray-x/go.nvim/pull/478
@zdk i have problem with this config
{
"ray-x/go.nvim",
dependencies = {
"ray-x/guihua.lua",
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
},
opts = {
disable_defaults = true,
diagnostic = false,
},
event = { "CmdlineEnter" },
ft = { "go", "gomod" },
-- Prevents Neovim from freezing on plugin installation/update.
-- See: <https://github.com/ray-x/go.nvim/issues/433>
build = function() require("go.install").update_all() end,
},
try remove
opts = {
disable_defaults = true,
diagnostic = false,
},
for me it's work
@zdk i have problem with this config
{ "ray-x/go.nvim", dependencies = { "ray-x/guihua.lua", "neovim/nvim-lspconfig", "nvim-treesitter/nvim-treesitter", }, opts = { disable_defaults = true, diagnostic = false, }, event = { "CmdlineEnter" }, ft = { "go", "gomod" }, -- Prevents Neovim from freezing on plugin installation/update. -- See: <https://github.com/ray-x/go.nvim/issues/433> build = function() require("go.install").update_all() end, },
try remove
opts = { disable_defaults = true, diagnostic = false, },
for me it's work
Just tried removing this two options in the config. Does not seem to work for me.
@zdk try add init config line, i forget to add this.
config = function() require("go").setup() end,
full config
{
"ray-x/go.nvim",
dependencies = {
"ray-x/guihua.lua",
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
},
config = function() require("go").setup() end,
event = { "CmdlineEnter" },
ft = { "go", "gomod" },
-- Prevents Neovim from freezing on plugin installation/update.
-- See: <https://github.com/ray-x/go.nvim/issues/433>
build = function() require("go.install").update_all() end,
},
@nfort Thanks, adding config = function() require("go").setup() end,
seems working fine!!
Also, I have tried adding go="go"
in opts
(without having config = function() require("go").setup() end,
)
opts = {
go = "go",
disable_defaults = true,
diagnostics = false,
},
This also seems works... 🤔
Anyway, thank you again!!
Correct, if you set disable_defaults = true,
it will reset all fields in the config to lua empty value. which means you have to set your go
binary.
hi, i use AstroNvim with community go pack. When i run GoRun command in cmdline, i got some notifications
warning: command run not supported, please update install.lua, or manually install it WARN: please wait for run to be installed and re-run the command INFO: installing run