local g={"\114\097\121-\120\047\103\111\046\110\118\105\109",dependencies={"\114\097\121-\120\047\103\117\105\104\117\097\046\108\117\097"};ft={"\103\111";"\103\111\109\111\100"};build="\058\108\117\097 \114\101\113\117\105\114\101\040\"\103\111\046\105\110\115\116\097\108\108\"\041\046\117\112\100\097\116\101\095\097\108\108\095\115\121\110\099\040\041",config=function()local g=require("\099\111\114\101\046\117\116\105\108\115\046\105\099\111\110\115");(require("\103\111")).setup({go="\103\111";goimports="\103\111\112\108\115";fillstruct="\103\111\112\108\115",gofmt="\103\111\112\108\115";max_line_len=0,tag_transform=false,test_template="";test_template_dir="";comment_placeholder="";icons={breakpoint=g.ui.Yoga;currentpos=g.ui.RunningMan},verbose=false;lsp_cfg=true,lsp_gofumpt=false,lsp_on_attach=function(g,z)(require("\099\111\114\101\046\112\108\117\103\105\110\115\046\108\115\112\046\107\101\121\115")).on_attach(g,z)local P=require("\119\104\105\099\104-\107\101\121")P.add({{"\060\108\101\097\100\101\114\062\099",group="\067\111\100\105\110\103"};{"\060\108\101\097\100\101\114\062\099\097","\060\099\109\100\062\071\111\067\111\100\101\065\099\116\105\111\110\060\099\114\062",desc="\067\111\100\101 \097\099\116\105\111\110"};{"\060\108\101\097\100\101\114\062\099\101";"\060\099\109\100\062\071\111\073\102\069\114\114\060\099\114\062";desc="\065\100\100 \105\102 \101\114\114"},{"\060\108\101\097\100\101\114\062\099\104",group="\072\101\108\112\101\114"};{"\060\108\101\097\100\101\114\062\099\104\097";"\060\099\109\100\062\071\111\065\100\100\084\097\103\060\099\114\062",desc="\065\100\100 \116\097\103\115 \116\111 \115\116\114\117\099\116"},{"\060\108\101\097\100\101\114\062\099\104\099";"\060\099\109\100\062\071\111\067\111\118\101\114\097\103\101\060\099\114\062",desc="\084\101\115\116 \099\111\118\101\114\097\103\101"},{"\060\108\101\097\100\101\114\062\099\104\103";"\060\099\109\100\062\108\117\097 \114\101\113\117\105\114\101\040\'\103\111\046\099\111\109\109\101\110\116\'\041\046\103\101\110\040\041\060\099\114\062",desc="\071\101\110\101\114\097\116\101 \099\111\109\109\101\110\116"};{"\060\108\101\097\100\101\114\062\099\104\105","\060\099\109\100\062\071\111\077\111\100\073\110\105\116\060\099\114\062";desc="\071\111 \109\111\100 \105\110\105\116"},{"\060\108\101\097\100\101\114\062\099\104\114","\060\099\109\100\062\071\111\082\077\084\097\103\060\099\114\062";desc="\082\101\109\111\118\101 \116\097\103\115 \116\111 \115\116\114\117\099\116"},{"\060\108\101\097\100\101\114\062\099\104\116";"\060\099\109\100\062\071\111\077\111\100\084\105\100\121\060\099\114\062";desc="\071\111 \109\111\100 \116\105\100\121"};{"\060\108\101\097\100\101\114\062\099\104\118","\060\099\109\100\062\071\111\086\101\116\060\099\114\062",desc="\071\111 \118\101\116"},{"\060\108\101\097\100\101\114\062\099\105";"\060\099\109\100\062\071\111\084\111\103\103\108\101\073\110\108\097\121\060\099\114\062",desc="\084\111\103\103\108\101 \105\110\108\097\121"};{"\060\108\101\097\100\101\114\062\099\108","\060\099\109\100\062\071\111\076\105\110\116\060\099\114\062";desc="\082\117\110 \108\105\110\116\101\114"};{"\060\108\101\097\100\101\114\062\099\111";"\060\099\109\100\062\071\111\080\107\103\079\117\116\108\105\110\101\060\099\114\062";desc="\079\117\116\108\105\110\101"},{"\060\108\101\097\100\101\114\062\099\114","\060\099\109\100\062\071\111\082\117\110\060\099\114\062",desc="\082\117\110"};{"\060\108\101\097\100\101\114\062\099\115","\060\099\109\100\062\071\111\070\105\108\108\083\116\114\117\099\116\060\099\114\062",desc="\065\117\116\111\102\105\108\108 \115\116\114\117\099\116"};{"\060\108\101\097\100\101\114\062\099\116",group="\084\101\115\116\115"};{"\060\108\101\097\100\101\114\062\099\116\097","\060\099\109\100\062\071\111\065\108\116\033\060\099\114\062";desc="\079\112\101\110 \097\108\116 \102\105\108\101"},{"\060\108\101\097\100\101\114\062\099\116\102";"\060\099\109\100\062\071\111\084\101\115\116\070\105\108\101\060\099\114\062";desc="\082\117\110 \116\101\115\116 \102\111\114 \099\117\114\114\101\110\116 \102\105\108\101"};{"\060\108\101\097\100\101\114\062\099\116\114";"\060\099\109\100\062\071\111\084\101\115\116\060\099\114\062";desc="\082\117\110 \116\101\115\116\115"};{"\060\108\101\097\100\101\114\062\099\116\115","\060\099\109\100\062\071\111\065\108\116\083\033\060\099\114\062",desc="\079\112\101\110 \097\108\116 \102\105\108\101 \105\110 \115\112\108\105\116"};{"\060\108\101\097\100\101\114\062\099\116\117","\060\099\109\100\062\071\111\084\101\115\116\070\117\110\099\060\099\114\062";desc="\082\117\110 \116\101\115\116 \102\111\114 \099\117\114\114\101\110\116 \102\117\110\099"};{"\060\108\101\097\100\101\114\062\099\116\118";"\060\099\109\100\062\071\111\065\108\116\086\033\060\099\114\062";desc="\079\112\101\110 \097\108\116 \102\105\108\101 \105\110 \118\101\114\116\105\099\097\108 \115\112\108\105\116"},{"\060\108\101\097\100\101\114\062\099\120";group="\067\111\100\101 \076\101\110\115"};{"\060\108\101\097\100\101\114\062\099\120\097";"\060\099\109\100\062\071\111\067\111\100\101\065\099\116\105\111\110\060\099\114\062";desc="\067\111\100\101 \065\099\116\105\111\110"};{"\060\108\101\097\100\101\114\062\099\120\108","\060\099\109\100\062\071\111\067\111\100\101\076\101\110\065\099\116\060\099\114\062",desc="\084\111\103\103\108\101 \076\101\110\115"}})P.add({{"\060\108\101\097\100\101\114\062\099\106";"\060\099\109\100\062\'\060\044\'\062\071\111\074\115\111\110\050\083\116\114\117\099\116\060\099\114\062";desc="\074\115\111\110 \116\111 \115\116\114\117\099\116",mode="\118"}})end,lsp_codelens=true,lsp_keymaps=false,diagnostic={hdlr=true;underline=true;virtual_text={space=0,prefix=g.arrows.Diamond},signs=true;update_in_insert=false};lsp_document_formatting=false;lsp_inlay_hints={enable=false;only_current_line=false,only_current_line_autocmd="\067\117\114\115\111\114\072\111\108\100";show_variable_name=true,show_parameter_hints=true,other_hints_prefix="\061\062 ",max_len_align=false,max_len_align_padding=1;right_align=false,right_align_padding=6;highlight="\067\111\109\109\101\110\116"},gopls_cmd=nil,gopls_remote_auto=true;gocoverage_sign="\226\150\136",dap_debug=false;dap_debug_keymap=false,dap_debug_gui=false,dap_debug_vt=false,build_tags="",textobjects=true,test_runner="\103\111",run_in_floaterm=false,luasnip=true})end}return g
-- Plugin for Go language development
local M = {
  'ray-x/go.nvim',
  dependencies = {
    'ray-x/guihua.lua',
  },
  ft = { 'go', 'gomod' },
  build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
  config = function()
    local icons = require 'core.utils.icons'
    require('go').setup {
      -- NOTE: all LSP and formatting related options are disabeld.
      -- NOTE: is not related to core.plugins.lsp
      -- NOTE: manages LSP on its own
      go = 'go', -- go command, can be go[default] or go1.18beta1
      goimports = 'gopls', -- goimport command, can be gopls[default] or goimport
      fillstruct = 'gopls', -- can be nil (use fillstruct, slower) and gopls
      gofmt = 'gopls', -- gofmt cmd,
      max_line_len = 0, -- max line length in goline format
      tag_transform = false, -- tag_transfer  check gomodifytags for details
      test_template = '', -- default to testify if not set; g:go_nvim_tests_template  check gotests for details
      test_template_dir = '', -- default to nil if not set; g:go_nvim_tests_template_dir  check gotests for details
      comment_placeholder = '', -- comment_placeholder your cool placeholder e.g. ﳑ       
      icons = { breakpoint = icons.ui.Yoga, currentpos = icons.ui.RunningMan },
      verbose = false, -- output loginf in messages
      lsp_cfg = true, -- true: use non-default gopls setup specified in go/lsp.lua
      -- false: do nothing
      -- if lsp_cfg is a table, merge table with with non-default gopls setup in go/lsp.lua, e.g.
      --   lsp_cfg = {settings={gopls={matcher='CaseInsensitive', ['local'] = 'your_local_module_path', gofumpt = true }}}
      lsp_gofumpt = false, -- true: set default gofmt in gopls format to gofumpt
      lsp_on_attach = function(client, bufnr)
        -- attach my LSP configs keybindings
        require('core.plugins.lsp.keys').on_attach(client, bufnr)
        local wk = require 'which-key'
        wk.add {
          { '<leader>c', group = 'Coding' },
          { '<leader>ca', '<cmd>GoCodeAction<cr>', desc = 'Code action' },
          { '<leader>ce', '<cmd>GoIfErr<cr>', desc = 'Add if err' },
          { '<leader>ch', group = 'Helper' },
          { '<leader>cha', '<cmd>GoAddTag<cr>', desc = 'Add tags to struct' },
          { '<leader>chc', '<cmd>GoCoverage<cr>', desc = 'Test coverage' },
          { '<leader>chg', "<cmd>lua require('go.comment').gen()<cr>", desc = 'Generate comment' },
          { '<leader>chi', '<cmd>GoModInit<cr>', desc = 'Go mod init' },
          { '<leader>chr', '<cmd>GoRMTag<cr>', desc = 'Remove tags to struct' },
          { '<leader>cht', '<cmd>GoModTidy<cr>', desc = 'Go mod tidy' },
          { '<leader>chv', '<cmd>GoVet<cr>', desc = 'Go vet' },
          { '<leader>ci', '<cmd>GoToggleInlay<cr>', desc = 'Toggle inlay' },
          { '<leader>cl', '<cmd>GoLint<cr>', desc = 'Run linter' },
          { '<leader>co', '<cmd>GoPkgOutline<cr>', desc = 'Outline' },
          { '<leader>cr', '<cmd>GoRun<cr>', desc = 'Run' },
          { '<leader>cs', '<cmd>GoFillStruct<cr>', desc = 'Autofill struct' },
          { '<leader>ct', group = 'Tests' },
          { '<leader>cta', '<cmd>GoAlt!<cr>', desc = 'Open alt file' },
          { '<leader>ctf', '<cmd>GoTestFile<cr>', desc = 'Run test for current file' },
          { '<leader>ctr', '<cmd>GoTest<cr>', desc = 'Run tests' },
          { '<leader>cts', '<cmd>GoAltS!<cr>', desc = 'Open alt file in split' },
          { '<leader>ctu', '<cmd>GoTestFunc<cr>', desc = 'Run test for current func' },
          { '<leader>ctv', '<cmd>GoAltV!<cr>', desc = 'Open alt file in vertical split' },
          { '<leader>cx', group = 'Code Lens' },
          { '<leader>cxa', '<cmd>GoCodeAction<cr>', desc = 'Code Action' },
          { '<leader>cxl', '<cmd>GoCodeLenAct<cr>', desc = 'Toggle Lens' },
        }
        wk.add {
          { '<leader>cj', "<cmd>'<,'>GoJson2Struct<cr>", desc = 'Json to struct', mode = 'v' },
        }
      end, -- nil: use on_attach function defined in go/lsp.lua,
      --      when lsp_cfg is true
      -- if lsp_on_attach is a function: use this function as on_attach function for gopls
      lsp_codelens = true, -- set to false to disable codelens, true by default
      lsp_keymaps = false, -- set to false to disable gopls/lsp keymap
      diagnostic = { -- set diagnostic to false to disable vim.diagnostic setup
        hdlr = true, -- hook lsp diag handler
        underline = true,
        -- virtual text setup
        virtual_text = { space = 0, prefix = icons.arrows.Diamond },
        signs = true,
        update_in_insert = false,
      },
      lsp_document_formatting = false,
      -- set to true: use gopls to format
      -- false if you want to use other formatter tool(e.g. efm, nulls)
      lsp_inlay_hints = {
        enable = false,
        -- Only show inlay hints for the current line
        only_current_line = false,
        -- Event which triggers a refersh of the inlay hints.
        -- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
        -- not that this may cause higher CPU usage.
        -- This option is only respected when only_current_line and
        -- autoSetHints both are true.
        only_current_line_autocmd = 'CursorHold',
        -- whether to show variable name before type hints with the inlay hints or not
        -- default: false
        show_variable_name = true,
        -- prefix for parameter hints
        -- parameter_hints_prefix = ' ',
        show_parameter_hints = true,
        -- prefix for all the other hints (type, chaining)
        other_hints_prefix = '=> ',
        -- whether to align to the length of the longest line in the file
        max_len_align = false,
        -- padding from the left if max_len_align is true
        max_len_align_padding = 1,
        -- whether to align to the extreme right or not
        right_align = false,
        -- padding from the right if right_align is true
        right_align_padding = 6,
        -- The color of the hints
        highlight = 'Comment',
      },
      gopls_cmd = nil, -- if you need to specify gopls path and cmd, e.g {"/home/user/lsp/gopls", "-logfile","/var/log/gopls.log" }
      gopls_remote_auto = true, -- add -remote=auto to gopls
      gocoverage_sign = '█',
      dap_debug = false, -- set to false to disable dap
      dap_debug_keymap = false, -- true: use keymap for debugger defined in go/dap.lua
      -- false: do not use keymap in go/dap.lua.  you must define your own.
      dap_debug_gui = false, -- set to true to enable dap gui, highly recommended
      dap_debug_vt = false, -- set to true to enable dap virtual text
      build_tags = '', -- set default build tags
      textobjects = true, -- enable default text jobects through treesittter-text-objects
      test_runner = 'go', -- richgo, go test, richgo, dlv, ginkgo
      run_in_floaterm = false, -- set to true to run in float window.
      -- float term recommended if you use richgo/ginkgo with terminal color
      luasnip = true,
    }
  end,
}

return M
