require('go').setup {
    -- auto commands
    auto_format = false,
    auto_lint = false,
    -- linters: revive, errcheck, staticcheck, golangci-lint
    linter = 'revive',
    -- linter_flags: e.g., {revive = {'-config', '/path/to/config.yml'}}
    linter_flags = {},
    -- lint_prompt_style: qf (quickfix), vt (virtual text)
    lint_prompt_style = 'qf',
    -- formatter: goimports, gofmt, gofumpt
    formatter = 'gofumpt',
    -- test flags: -count=1 will disable cache
    test_flags = {'-v'},
    test_timeout = '30s',
    test_env = {},
    -- show test result with popup window
    test_popup = true,
    test_popup_width = 80,
    test_popup_height = 15,
    -- test open
    test_open_cmd = 'edit',
    -- struct tags
    tags_name = 'json',
    tags_options = {'json=omitempty'},
    tags_transform = 'snakecase',
    tags_flags = {'-skip-unexported'},
    -- quick type
    quick_type_flags = {'--just-types'},
}

vim.cmd [[
  augroup nvimgo_keymaps
      autocmd!
      autocmd FileType go nnoremap <buffer><leader>t :GoTest<cr>
      autocmd FileType go nnoremap <buffer><leader>tf :GoTestFunc<cr>
      autocmd FileType go nnoremap <buffer><leader>tF :GoTestFile<cr>
      autocmd FileType go nnoremap <buffer><leader>ta :GoTestAll<cr>
      autocmd FileType go nnoremap <buffer><leader>a :GoToTest<cr>
      autocmd User NvimGoTestPopupPost nnoremap <buffer><Esc> :q<cr>
  augroup END
]]
