This is pretty specific but I've hit it numerous times and got ultra-frustrated because it usually happens precisely when you don't feel like doing side quests to fix your editor.

Symptom

Autocomplete no longer works.

You try to lsp-workspace-restart but that's futile.

You try to pkill gopls but it's useless.

The usual suspects

go.mod

Do you have a go.mod file? You should have a go.mod file.

  go mod init <package_name>

LSP workspaces

Is your LSP workspace set correctly or does it end up somewhere in /home/user or equivalent nonsense when it should actually point to the root of your project?

Look for your buffer in lsp-describe-session. If it's in the wrong workspace, use these commands to fix that:

  Emacs Commands (spacemacs bindings)

  lsp-workspace-folders-add , F a
  lsp-workspace-folders-open
  lsp-workspace-folders-remove , F r

lsp-workspace-folder-add with the root dir of my project usually helps.

PS: Where does LSP persist the session?

The list of LSP workspaces is stored in ~/.emacs.d/.lsp-session-v1.