Skip to content

x/tools/gopls: bad go.mod affects anayses but not formatting; no errors in logs #44204

@ainar-g

Description

@ainar-g

What did you do?

I'm using Neovim nightly (0.5.0+ubuntu2+git202102080233-02a3c4179) with the official nvim-lspconfig package installed (041dfd7f). My configuration:

lspconfig = require "lspconfig"
lspconfig.gopls.setup {
  cmd = {"gopls", "serve"},
  log_level = vim.lsp.protocol.MessageType.Log,
  message_level = vim.lsp.protocol.MessageType.Log,
  settings = {
    gopls = {
      analyses = {
        fieldalignment = true,
        --
      },
      ["build.experimentalWorkspaceModule"] = true,
      ["formatting.gofumpt"] = true,
      ["staticcheck"] = true,
      ["ui.verboseOutput"] = true,
    },
  },
}

In one of my personal projects I've had a bad go.mod:

package example.com/mod

Notice the keyword package instead of module.

What did you expect to see?

Error messages in the logs.

What did you see instead?

No error messages. Formatting works, but not analyses like fieldalignment.

Build info

golang.org/x/tools/gopls master
    golang.org/x/tools/gopls@v0.0.0-20210210013322-d4590503678b h1:ln+MiJnzcfN8CAjS49XevFBaRh/Pv0b21htr04EB9WY=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/google/go-cmp@v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/mod@v0.4.1 h1:Kvvh58BN8Y9/lBi7hTekvtMpm07eUZ0ck5pRHpsMWrY=
    golang.org/x/sync@v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
    golang.org/x/sys@v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
    golang.org/x/tools@v0.1.1-0.20210210013322-d4590503678b h1:uapRsD3vvVzFdGVOgFK3KMVqeDpdrxqhe5/UNZS6mwg=
    golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
    honnef.co/go/tools@v0.1.1 h1:EVDuO03OCZwpV2t/tLLxPmPiomagMoBOgfPt0FM+4IY=
    mvdan.cc/gofumpt@v0.1.0 h1:hsVv+Y9UsZ/mFZTxJZuHVI6shSQCtzZ11h1JEFPAZLw=
    mvdan.cc/xurls/v2@v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=

I am ready to provide any additional information.

EDIT: Possibly related to #36531?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions