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

x/tools/gopls: analyzer fillstruct does not return any diagnoses #63667

Closed
AnhQuanTrl opened this issue Oct 22, 2023 · 1 comment
Closed

x/tools/gopls: analyzer fillstruct does not return any diagnoses #63667

AnhQuanTrl opened this issue Oct 22, 2023 · 1 comment
Labels
gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@AnhQuanTrl
Copy link

gopls version

v0.13.2

go env

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/arthur/.cache/go-build'
GOENV='/home/arthur/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/arthur/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/arthur/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.1'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/arthur/personal/goplstest/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build608842351=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I use this snippet below to test if the fillstruct analyzer works in Neovim editor:

package fillstruct

type Foo struct {
	A int
}

type Bar struct {
	X *Foo
	Y *Foo
}

var _ = Bar{
	X: &Foo{},
}

What did you expect to see?

There should be diagnostics with a message "Fill Bar"

What did you see instead?

No diagnostics appear. Also I check the log of the lsp and see empty response from textDocument/publishDiagnostics.

Editor and settings

My Neovim lspconfig:

settings = {
            gopls = {
              analyses = {
                appends = true,
                nilness = true,
                unusedparams = true,
                unusedwrite = true,
                useany = true,
                fillstruct = true,
              },
              hints = {
                assignVariableTypes = true,
                compositeLiteralFields = true,
                compositeLiteralTypes = true,
                constantValues = true,
                functionTypeParameters = true,
                parameterNames = true,
                rangeVariableTypes = true,
              },
              codelenses = {
                gc_details = false,
                generate = true,
                regenerate_cgo = true,
                run_govulncheck = true,
                test = true,
                tidy = true,
                upgrade_dependency = true,
                vendor = true,
              },
              gofumpt = true,
              semanticTokens = true,
              usePlaceholders = true,
              symbolScope = 'workspace',
              directoryFilters = { '-.git', '-.vscode', '-.idea', '-.vscode-test', '-node_modules' },
              buildFlags = { '-tags=tools' },
            },
          },

Logs

Some logs I capture from running

[INFO][2023-10-22 15:45:29] .../vim/lsp/rpc.lua:634	"Starting RPC client"	{  args = {},  cmd = "/home/arthur/.local/share/nvim/mason/bin/gopls",  extra = {    cwd = "/home/arthur/personal/goplstest"  }}
[DEBUG][2023-10-22 15:45:29] .../vim/lsp/rpc.lua:261	"rpc.send"	{  id = 1,  jsonrpc = "2.0",  method = "initialize",  params = {    capabilities = {      general = {        positionEncodings = { "utf-16" }      },      textDocument = {        callHierarchy = {          dynamicRegistration = false        },        codeAction = {          codeActionLiteralSupport = {            codeActionKind = {              valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }            }          },          dataSupport = true,          dynamicRegistration = true,          isPreferredSupport = true,          resolveSupport = {            properties = { "edit" }          }        },        completion = {          completionItem = {            commitCharactersSupport = true,            deprecatedSupport = true,            documentationFormat = { "markdown", "plaintext" },            insertReplaceSupport = true,            insertTextModeSupport = {              valueSet = { 1, 2 }            },            labelDetailsSupport = true,            preselectSupport = true,            resolveSupport = {              properties = { "documentation", "detail", "additionalTextEdits", "sortText", "filterText", "insertText", "textEdit", "insertTextFormat", "insertTextMode" }            },            snippetSupport = true,            tagSupport = {              valueSet = { 1 }            }          },          completionItemKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }          },          completionList = {            itemDefaults = { "commitCharacters", "editRange", "insertTextFormat", "insertTextMode", "data" }          },          contextSupport = true,          dynamicRegistration = false,          insertTextMode = 1        },        declaration = {          linkSupport = true        },        definition = {          dynamicRegistration = true,          linkSupport = true        },        diagnostic = {          dynamicRegistration = false        },        documentHighlight = {          dynamicRegistration = false        },        documentSymbol = {          dynamicRegistration = false,          hierarchicalDocumentSymbolSupport = true,          symbolKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }          }        },        formatting = {          dynamicRegistration = true        },        hover = {          contentFormat = { "markdown", "plaintext" },          dynamicRegistration = true        },        implementation = {          linkSupport = true        },        inlayHint = {          dynamicRegistration = true,          resolveSupport = {            properties = {}          }        },        publishDiagnostics = {          dataSupport = true,          relatedInformation = true,          tagSupport = {            valueSet = { 1, 2 }          }        },        rangeFormatting = {          dynamicRegistration = true        },        references = {          dynamicRegistration = false        },        rename = {          dynamicRegistration = true,          prepareSupport = true        },        semanticTokens = {          augmentsSyntaxTokens = true,          dynamicRegistration = false,          formats = { "relative" },          multilineTokenSupport = false,          overlappingTokenSupport = true,          requests = {            full = {              delta = true            },            range = false          },          serverCancelSupport = false,          tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },          tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }        },        signatureHelp = {          dynamicRegistration = false,          signatureInformation = {            activeParameterSupport = true,            documentationFormat = { "markdown", "plaintext" },            parameterInformation = {              labelOffsetSupport = true            }          }        },        synchronization = {          didSave = true,          dynamicRegistration = false,          willSave = true,          willSaveWaitUntil = true        },        typeDefinition = {          linkSupport = true        }      },      window = {        showDocument = {          support = true        },        showMessage = {          messageActionItem = {            additionalPropertiesSupport = false          }        },        workDoneProgress = true      },      workspace = {        applyEdit = true,        configuration = true,        didChangeWatchedFiles = {          dynamicRegistration = true,          relativePatternSupport = true        },        inlayHint = {          refreshSupport = true        },        semanticTokens = {          refreshSupport = true        },        symbol = {          dynamicRegistration = false,          symbolKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }          }        },        workspaceEdit = {          resourceOperations = { "rename", "create", "delete" }        },        workspaceFolders = true      }    },    clientInfo = {      name = "Neovim",      version = "0.10.0-dev+594ff34"    },    initializationOptions = vim.empty_dict(),    processId = 309362,    rootPath = "/home/arthur/personal/goplstest",    rootUri = "file:///home/arthur/personal/goplstest",    trace = "off",    workspaceFolders = { {        name = "/home/arthur/personal/goplstest",        uri = "file:///home/arthur/personal/goplstest"      } }  }}
[DEBUG][2023-10-22 15:45:29] .../vim/lsp/rpc.lua:364	"rpc.receive"	{  id = 1,  jsonrpc = "2.0",  result = {    capabilities = {      callHierarchyProvider = true,      codeActionProvider = {        codeActionKinds = { "quickfix", "refactor.extract", "refactor.rewrite", "source.fixAll", "source.organizeImports" }      },      codeLensProvider = vim.empty_dict(),      completionProvider = {        triggerCharacters = { "." }      },      definitionProvider = true,      documentFormattingProvider = true,      documentHighlightProvider = true,      documentLinkProvider = vim.empty_dict(),      documentSymbolProvider = true,      executeCommandProvider = {        commands = { "gopls.add_dependency", "gopls.add_import", "gopls.apply_fix", "gopls.check_upgrades", "gopls.edit_go_directive", "gopls.fetch_vulncheck_result", "gopls.gc_details", "gopls.generate", "gopls.go_get_package", "gopls.list_imports", "gopls.list_known_packages", "gopls.mem_stats", "gopls.regenerate_cgo", "gopls.remove_dependency", "gopls.reset_go_mod_diagnostics", "gopls.run_go_work_command", "gopls.run_govulncheck", "gopls.run_tests", "gopls.start_debugging", "gopls.start_profile", "gopls.stop_profile", "gopls.test", "gopls.tidy", "gopls.toggle_gc_details", "gopls.update_go_sum", "gopls.upgrade_dependency", "gopls.vendor", "gopls.workspace_stats" }      },      foldingRangeProvider = true,      hoverProvider = true,      implementationProvider = true,      inlayHintProvider = vim.empty_dict(),      referencesProvider = true,      renameProvider = {        prepareProvider = true      },      selectionRangeProvider = true,      semanticTokensProvider = {        full = true,        legend = {          tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },          tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }        },        range = true      },      signatureHelpProvider = {        triggerCharacters = { "(", "," }      },      textDocumentSync = {        change = 2,        openClose = true,        save = vim.empty_dict()      },      typeDefinitionProvider = true,      workspace = {        workspaceFolders = {          changeNotifications = "workspace/didChangeWorkspaceFolders",          supported = true        }      },      workspaceSymbolProvider = true    },    serverInfo = {      name = "gopls",      version = '{"GoVersion":"go1.21.1","Path":"golang.org/x/tools/gopls","Main":{"Path":"golang.org/x/tools/gopls","Version":"v0.13.2","Sum":"h1:Pyvx6MKvatbX3zzZmdGiFRfQZl0ohPlt2sFxO/5j6Ro=","Replace":null},"Deps":[{"Path":"github.com/BurntSushi/toml","Version":"v1.2.1","Sum":"h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=","Replace":null},{"Path":"github.com/google/go-cmp","Version":"v0.5.9","Sum":"h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=","Replace":null},{"Path":"github.com/sergi/go-diff","Version":"v1.1.0","Sum":"h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=","Replace":null},{"Path":"golang.org/x/exp","Version":"v0.0.0-20220722155223-a9213eeb770e","Sum":"h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=","Replace":null},{"Path":"golang.org/x/exp/typeparams","Version":"v0.0.0-20221212164502-fae10dda9338","Sum":"h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=","Replace":null},{"Path":"golang.org/x/mod","Version":"v0.12.0","Sum":"h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=","Replace":null},{"Path":"golang.org/x/sync","Version":"v0.3.0","Sum":"h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=","Replace":null},{"Path":"golang.org/x/sys","Version":"v0.10.0","Sum":"h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=","Replace":null},{"Path":"golang.org/x/text","Version":"v0.11.0","Sum":"h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=","Replace":null},{"Path":"golang.org/x/tools","Version":"v0.11.2-0.20230810185051-cc6b5804b8cf","Sum":"h1:Oush7UwPamr2/iNeNFBuNFj89YyHn0YY69EKDdvANnk=","Replace":null},{"Path":"golang.org/x/vuln","Version":"v0.0.0-20230110180137-6ad3e3d07815","Sum":"h1:A9kONVi4+AnuOr1dopsibH6hLi1Huy54cbeJxnq4vmU=","Replace":null},{"Path":"honnef.co/go/tools","Version":"v0.4.2","Sum":"h1:6qXr+R5w+ktL5UkwEbPp+fEvfyoMPche6GkOpGHZcLc=","Replace":null},{"Path":"mvdan.cc/gofumpt","Version":"v0.4.0","Sum":"h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=","Replace":null},{"Path":"mvdan.cc/xurls/v2","Version":"v2.4.0","Sum":"h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=","Replace":null}],"Settings":[{"Key":"-buildmode","Value":"exe"},{"Key":"-compiler","Value":"gc"},{"Key":"DefaultGODEBUG","Value":"panicnil=1"},{"Key":"CGO_ENABLED","Value":"1"},{"Key":"CGO_CFLAGS","Value":""},{"Key":"CGO_CPPFLAGS","Value":""},{"Key":"CGO_CXXFLAGS","Value":""},{"Key":"CGO_LDFLAGS","Value":""},{"Key":"GOARCH","Value":"amd64"},{"Key":"GOOS","Value":"linux"},{"Key":"GOAMD64","Value":"v1"}],"Version":"v0.13.2"}'    }  }}
[DEBUG][2023-10-22 15:45:29] .../vim/lsp/rpc.lua:261	"rpc.send"	{  jsonrpc = "2.0",  method = "initialized",  params = vim.empty_dict()}
[DEBUG][2023-10-22 15:45:29] .../vim/lsp/rpc.lua:261	"rpc.send"	{  jsonrpc = "2.0",  method = "workspace/didChangeConfiguration",  params = {    settings = {      gopls = {        analyses = {          appends = true,          fillstruct = true,          nilness = true,          unusedparams = true,          unusedwrite = true,          useany = true        },        buildFlags = { "-tags=tools" },        codelenses = {          gc_details = false,          generate = true,          regenerate_cgo = true,          run_govulncheck = true,          test = true,          tidy = true,          upgrade_dependency = true,          vendor = true        },        directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },        gofumpt = true,        hints = {          assignVariableTypes = true,          compositeLiteralFields = true,          compositeLiteralTypes = true,          constantValues = true,          functionTypeParameters = true,          parameterNames = true,          rangeVariableTypes = true        },        semanticTokens = true,        symbolScope = "workspace",        usePlaceholders = true      }    }  }}
[DEBUG][2023-10-22 15:45:29] .../vim/lsp/rpc.lua:261	"rpc.send"	{  jsonrpc = "2.0",  method = "workspace/didChangeConfiguration",  params = {    settings = {      gopls = {        analyses = {          appends = true,          fillstruct = true,          nilness = true,          unusedparams = true,          unusedwrite = true,          useany = true        },        buildFlags = { "-tags=tools" },        codelenses = {          gc_details = false,          generate = true,          regenerate_cgo = true,          run_govulncheck = true,          test = true,          tidy = true,          upgrade_dependency = true,          vendor = true        },        directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },        gofumpt = true,        hints = {          assignVariableTypes = true,          compositeLiteralFields = true,          compositeLiteralTypes = true,          constantValues = true,          functionTypeParameters = true,          parameterNames = true,          rangeVariableTypes = true        },        semanticTokens = true,        symbolScope = "workspace",        usePlaceholders = true      }    }  }}
[INFO][2023-10-22 15:45:29] .../lua/vim/lsp.lua:1458	"LSP[gopls]"	"server_capabilities"	{  server_capabilities = {    callHierarchyProvider = true,    codeActionProvider = {      codeActionKinds = { "quickfix", "refactor.extract", "refactor.rewrite", "source.fixAll", "source.organizeImports" }    },    codeLensProvider = vim.empty_dict(),    completionProvider = {      triggerCharacters = { "." }    },    definitionProvider = true,    documentFormattingProvider = true,    documentHighlightProvider = true,    documentLinkProvider = vim.empty_dict(),    documentSymbolProvider = true,    executeCommandProvider = {      commands = { "gopls.add_dependency", "gopls.add_import", "gopls.apply_fix", "gopls.check_upgrades", "gopls.edit_go_directive", "gopls.fetch_vulncheck_result", "gopls.gc_details", "gopls.generate", "gopls.go_get_package", "gopls.list_imports", "gopls.list_known_packages", "gopls.mem_stats", "gopls.regenerate_cgo", "gopls.remove_dependency", "gopls.reset_go_mod_diagnostics", "gopls.run_go_work_command", "gopls.run_govulncheck", "gopls.run_tests", "gopls.start_debugging", "gopls.start_profile", "gopls.stop_profile", "gopls.test", "gopls.tidy", "gopls.toggle_gc_details", "gopls.update_go_sum", "gopls.upgrade_dependency", "gopls.vendor", "gopls.workspace_stats" }    },    foldingRangeProvider = true,    hoverProvider = true,    implementationProvider = true,    inlayHintProvider = vim.empty_dict(),    referencesProvider = true,    renameProvider = {      prepareProvider = true    },    selectionRangeProvider = true,    semanticTokensProvider = {      full = true,      legend = {        tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },        tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }      },      range = true    },    signatureHelpProvider = {      triggerCharacters = { "(", "," }    },    textDocumentSync = {      change = 2,      openClose = true,      save = vim.empty_dict()    },    typeDefinitionProvider = true,    workspace = {      workspaceFolders = {        changeNotifications = "workspace/didChangeWorkspaceFolders",        supported = true      }    },    workspaceSymbolProvider = true  }}
[DEBUG][2023-10-22 15:45:29] .../vim/lsp/rpc.lua:261	"rpc.send"	{  jsonrpc = "2.0",  method = "textDocument/didOpen",  params = {    textDocument = {      languageId = "go",      text = "package fillstruct\n\ntype Foo struct {\n\tA int\n}\n\ntype Bar struct {\n\tX *Foo\n\tY *Foo\n}\n\nvar _ = Bar{\n\tX: &Foo{},\n}\n",      uri = "file:///home/arthur/personal/goplstest/fillstruct/fill.go",      version = 0    }  }}
[DEBUG][2023-10-22 15:45:29] .../lua/vim/lsp.lua:1506	"LSP[gopls]"	"client.request"	1	"textDocument/inlayHint"	{  range = {    ["end"] = {      character = 0,      line = 14    },    start = {      character = 0,      line = 0    }  },  textDocument = {    uri = "file:///home/arthur/personal/goplstest/fillstruct/fill.go"  }}	<function 1>	12
[DEBUG][2023-10-22 15:45:29] .../vim/lsp/rpc.lua:261	"rpc.send"	{  id = 2,  jsonrpc = "2.0",  method = "textDocument/inlayHint",  params = {    range = {      ["end"] = {        character = 0,        line = 14      },      start = {        character = 0,        line = 0      }    },    textDocument = {      uri = "file:///home/arthur/personal/goplstest/fillstruct/fill.go"    }  }}
[DEBUG][2023-10-22 15:45:29] .../vim/lsp/rpc.lua:364	"rpc.receive"	{  id = 1,  jsonrpc = "2.0",  method = "window/workDoneProgress/create",  params = {    token = "1312045435806158442"  }}
[DEBUG][2023-10-22 15:45:29] .../lua/vim/lsp.lua:1506	"LSP[gopls]"	"client.request"	1	"textDocument/inlayHint"	{  range = {    ["end"] = {      character = 0,      line = 14    },    start = {      character = 0,      line = 0    }  },  textDocument = {    uri = "file:///home/arthur/personal/goplstest/fillstruct/fill.go"  }}	<function 1>	12
[DEBUG][2023-10-22 15:45:29] .../vim/lsp/rpc.lua:261	"rpc.send"	{  id = 3,  jsonrpc = "2.0",  method = "textDocument/inlayHint",  params = {    range = {      ["end"] = {        character = 0,        line = 14      },      start = {        character = 0,        line = 0      }    },    textDocument = {      uri = "file:///home/arthur/personal/goplstest/fillstruct/fill.go"    }  }}
[DEBUG][2023-10-22 15:45:29] .../lua/vim/lsp.lua:1506	"LSP[gopls]"	"client.request"	1	"textDocument/semanticTokens/full"	{  textDocument = {    uri = "file:///home/arthur/personal/goplstest/fillstruct/fill.go"  }}	<function 1>	12
[DEBUG][2023-10-22 15:45:29] .../vim/lsp/rpc.lua:261	"rpc.send"	{  id = 4,  jsonrpc = "2.0",  method = "textDocument/semanticTokens/full",  params = {    textDocument = {      uri = "file:///home/arthur/personal/goplstest/fillstruct/fill.go"    }  }}
[DEBUG][2023-10-22 15:45:29] .../vim/lsp/rpc.lua:380	"server_request: callback result"	{  result = vim.NIL,  status = true}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:261	"rpc.send"	{  id = 3,  jsonrpc = "2.0",  result = vim.NIL}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:364	"rpc.receive"	{  id = 4,  jsonrpc = "2.0",  method = "workspace/configuration",  params = {    items = { {        section = "gopls"      } }  }}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:380	"server_request: callback result"	{  result = { {      analyses = {        appends = true,        fillstruct = true,        nilness = true,        unusedparams = true,        unusedwrite = true,        useany = true      },      buildFlags = { "-tags=tools" },      codelenses = {        gc_details = false,        generate = true,        regenerate_cgo = true,        run_govulncheck = true,        test = true,        tidy = true,        upgrade_dependency = true,        vendor = true      },      directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },      gofumpt = true,      hints = {        assignVariableTypes = true,        compositeLiteralFields = true,        compositeLiteralTypes = true,        constantValues = true,        functionTypeParameters = true,        parameterNames = true,        rangeVariableTypes = true      },      semanticTokens = true,      symbolScope = "workspace",      usePlaceholders = true    } },  status = true}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:261	"rpc.send"	{  id = 4,  jsonrpc = "2.0",  result = { {      analyses = {        appends = true,        fillstruct = true,        nilness = true,        unusedparams = true,        unusedwrite = true,        useany = true      },      buildFlags = { "-tags=tools" },      codelenses = {        gc_details = false,        generate = true,        regenerate_cgo = true,        run_govulncheck = true,        test = true,        tidy = true,        upgrade_dependency = true,        vendor = true      },      directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },      gofumpt = true,      hints = {        assignVariableTypes = true,        compositeLiteralFields = true,        compositeLiteralTypes = true,        constantValues = true,        functionTypeParameters = true,        parameterNames = true,        rangeVariableTypes = true      },      semanticTokens = true,      symbolScope = "workspace",      usePlaceholders = true    } }}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:364	"rpc.receive"	{  id = 5,  jsonrpc = "2.0",  method = "workspace/configuration",  params = {    items = { {        scopeUri = "file:///home/arthur/personal/goplstest",        section = "gopls"      } }  }}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:380	"server_request: callback result"	{  result = { {      analyses = {        appends = true,        fillstruct = true,        nilness = true,        unusedparams = true,        unusedwrite = true,        useany = true      },      buildFlags = { "-tags=tools" },      codelenses = {        gc_details = false,        generate = true,        regenerate_cgo = true,        run_govulncheck = true,        test = true,        tidy = true,        upgrade_dependency = true,        vendor = true      },      directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },      gofumpt = true,      hints = {        assignVariableTypes = true,        compositeLiteralFields = true,        compositeLiteralTypes = true,        constantValues = true,        functionTypeParameters = true,        parameterNames = true,        rangeVariableTypes = true      },      semanticTokens = true,      symbolScope = "workspace",      usePlaceholders = true    } },  status = true}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:261	"rpc.send"	{  id = 5,  jsonrpc = "2.0",  result = { {      analyses = {        appends = true,        fillstruct = true,        nilness = true,        unusedparams = true,        unusedwrite = true,        useany = true      },      buildFlags = { "-tags=tools" },      codelenses = {        gc_details = false,        generate = true,        regenerate_cgo = true,        run_govulncheck = true,        test = true,        tidy = true,        upgrade_dependency = true,        vendor = true      },      directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },      gofumpt = true,      hints = {        assignVariableTypes = true,        compositeLiteralFields = true,        compositeLiteralTypes = true,        constantValues = true,        functionTypeParameters = true,        parameterNames = true,        rangeVariableTypes = true      },      semanticTokens = true,      symbolScope = "workspace",      usePlaceholders = true    } }}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:364	"rpc.receive"	{  id = 6,  jsonrpc = "2.0",  method = "workspace/configuration",  params = {    items = { {        section = "gopls"      } }  }}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:380	"server_request: callback result"	{  result = { {      analyses = {        appends = true,        fillstruct = true,        nilness = true,        unusedparams = true,        unusedwrite = true,        useany = true      },      buildFlags = { "-tags=tools" },      codelenses = {        gc_details = false,        generate = true,        regenerate_cgo = true,        run_govulncheck = true,        test = true,        tidy = true,        upgrade_dependency = true,        vendor = true      },      directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },      gofumpt = true,      hints = {        assignVariableTypes = true,        compositeLiteralFields = true,        compositeLiteralTypes = true,        constantValues = true,        functionTypeParameters = true,        parameterNames = true,        rangeVariableTypes = true      },      semanticTokens = true,      symbolScope = "workspace",      usePlaceholders = true    } },  status = true}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:261	"rpc.send"	{  id = 6,  jsonrpc = "2.0",  result = { {      analyses = {        appends = true,        fillstruct = true,        nilness = true,        unusedparams = true,        unusedwrite = true,        useany = true      },      buildFlags = { "-tags=tools" },      codelenses = {        gc_details = false,        generate = true,        regenerate_cgo = true,        run_govulncheck = true,        test = true,        tidy = true,        upgrade_dependency = true,        vendor = true      },      directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },      gofumpt = true,      hints = {        assignVariableTypes = true,        compositeLiteralFields = true,        compositeLiteralTypes = true,        constantValues = true,        functionTypeParameters = true,        parameterNames = true,        rangeVariableTypes = true      },      semanticTokens = true,      symbolScope = "workspace",      usePlaceholders = true    } }}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:364	"rpc.receive"	{  id = 7,  jsonrpc = "2.0",  method = "workspace/configuration",  params = {    items = { {        scopeUri = "file:///home/arthur/personal/goplstest",        section = "gopls"      } }  }}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:380	"server_request: callback result"	{  result = { {      analyses = {        appends = true,        fillstruct = true,        nilness = true,        unusedparams = true,        unusedwrite = true,        useany = true      },      buildFlags = { "-tags=tools" },      codelenses = {        gc_details = false,        generate = true,        regenerate_cgo = true,        run_govulncheck = true,        test = true,        tidy = true,        upgrade_dependency = true,        vendor = true      },      directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },      gofumpt = true,      hints = {        assignVariableTypes = true,        compositeLiteralFields = true,        compositeLiteralTypes = true,        constantValues = true,        functionTypeParameters = true,        parameterNames = true,        rangeVariableTypes = true      },      semanticTokens = true,      symbolScope = "workspace",      usePlaceholders = true    } },  status = true}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:261	"rpc.send"	{  id = 7,  jsonrpc = "2.0",  result = { {      analyses = {        appends = true,        fillstruct = true,        nilness = true,        unusedparams = true,        unusedwrite = true,        useany = true      },      buildFlags = { "-tags=tools" },      codelenses = {        gc_details = false,        generate = true,        regenerate_cgo = true,        run_govulncheck = true,        test = true,        tidy = true,        upgrade_dependency = true,        vendor = true      },      directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },      gofumpt = true,      hints = {        assignVariableTypes = true,        compositeLiteralFields = true,        compositeLiteralTypes = true,        constantValues = true,        functionTypeParameters = true,        parameterNames = true,        rangeVariableTypes = true      },      semanticTokens = true,      symbolScope = "workspace",      usePlaceholders = true    } }}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:364	"rpc.receive"	{  jsonrpc = "2.0",  method = "textDocument/publishDiagnostics",  params = {    diagnostics = {},    uri = "file:///home/arthur/personal/goplstest/fillstruct/fill.go"  }}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:364	"rpc.receive"	{  id = 4,  jsonrpc = "2.0",  result = {    data = { 0, 0, 7, 15, 0, 0, 8, 10, 0, 0, 2, 0, 4, 15, 0, 0, 5, 3, 1, 2, 0, 4, 6, 15, 0, 1, 1, 1, 8, 2, 0, 2, 3, 1, 512, 3, 0, 4, 15, 0, 0, 5, 3, 1, 2, 0, 4, 6, 15, 0, 1, 1, 1, 8, 2, 0, 2, 1, 21, 0, 0, 1, 3, 1, 0, 1, 1, 1, 8, 2, 0, 2, 1, 21, 0, 0, 1, 3, 1, 0, 3, 0, 3, 15, 0, 0, 4, 1, 8, 2, 0, 4, 3, 1, 0, 1, 1, 1, 8, 0, 0, 3, 1, 21, 0, 0, 1, 3, 1, 0 },    resultId = "2023-10-22 15:45:30.230666321 +0700 +07 m=+1.127840532"  }}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:364	"rpc.receive"	{  id = 2,  jsonrpc = "2.0"}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:364	"rpc.receive"	{  id = 3,  jsonrpc = "2.0"}
[DEBUG][2023-10-22 15:45:30] .../vim/lsp/rpc.lua:364	"rpc.receive"	{  id = 5,  jsonrpc = "2.0"}
[DEBUG][2023-10-22 15:45:31] .../lua/vim/lsp.lua:1506	"LSP[gopls]"	"client.request"	1	"textDocument/codeLens"	{  textDocument = {    uri = "file:///home/arthur/personal/goplstest/fillstruct/fill.go"  }}	<function 1>	12
[DEBUG][2023-10-22 15:45:31] .../vim/lsp/rpc.lua:261	"rpc.send"	{  id = 6,  jsonrpc = "2.0",  method = "textDocument/codeLens",  params = {    textDocument = {      uri = "file:///home/arthur/personal/goplstest/fillstruct/fill.go"    }  }}
[DEBUG][2023-10-22 15:45:31] .../vim/lsp/rpc.lua:364	"rpc.receive"	{  id = 6,  jsonrpc = "2.0"}
[DEBUG][2023-10-22 15:45:31] .../vim/lsp/rpc.lua:364	"rpc.receive"	{  jsonrpc = "2.0",  method = "textDocument/publishDiagnostics",  params = {    diagnostics = { {        message = 'import "golang.org/x/tools/cmd/stringer" is a program, not an importable package',        range = {          ["end"] = {            character = 1,            line = 6          },          start = {            character = 1,            line = 6          }        },        severity = 1,        source = "go list"      } },    uri = "file:///home/arthur/personal/goplstest/tools.go"  }}
@AnhQuanTrl AnhQuanTrl added gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels Oct 22, 2023
@gopherbot gopherbot added this to the Unreleased milestone Oct 22, 2023
@ansaba ansaba added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 23, 2023
@findleyr
Copy link
Contributor

That's not how the fillstruct analyzer works: it is not used for producing diagnostics, only for producing code actions. (if it were to produce diagnostics it would be far too noisy).

There should be a code action available on the composite literal to fill the struct. Please comment if I'm misunderstanding or if that's not the case, and I'll reopen.

The fact that fillstruct is expressed as an analyzer is a historical artifact, and will be cleaned up in #61559.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants