Skip to content

Command 'gopls.package_symbols' failed: Error: no package metadata for file {filename} #3681

Closed
@BrunoKrugel

Description

@BrunoKrugel

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    -go1.23.6 darwin/arm64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • golang.org/x/tools/gopls v0.18.0-pre.1
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.93.1
  • Check your installed extensions to get the version of the VS Code Go extension
   golang.org/x/tools/[email protected] h1:+airkGmhm12YT67Lcv/SpkQfIe+9LiumzV1SL1+jNZU=
    github.com/BurntSushi/[email protected] h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs=
    github.com/google/[email protected] h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
    golang.org/x/exp/[email protected] h1:1xaZTydL5Gsg78QharTwKfA9FY9CZ1VQj6D/AZEvHR0=
    golang.org/x/[email protected] h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
    golang.org/x/[email protected] h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
    golang.org/x/[email protected] h1:L2k9GUV2TpQKVRGMjN94qfUMgUwOFimSQ6gipyJIjKw=
    golang.org/x/[email protected] h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
    golang.org/x/[email protected] h1:Hd/d+QygQ355a6wowhs7TdfG8iaFPkctgkKN/hhFRWU=
    golang.org/x/[email protected] h1:NPGnvPOTgnjBc9HTaUx+nj+EaUYxl5SJOWqaDYGaFYw=
    honnef.co/go/[email protected] h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I=
    mvdan.cc/[email protected] h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU=
    mvdan.cc/xurls/[email protected] h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file.
Share all the settings with the go. or ["go"] or gopls prefixes.

  "gopls": {
    "ui.diagnostic.staticcheck": true,
    "ui.semanticTokens": true,
    "verboseOutput": true,
    "codelenses": {
      "gc_details": true
    }
  },

Describe the bug

After Release v0.45.1, every time I save a non .go file in my project (for example, a .json or Makefile) I receive the error Command 'gopls.package_symbols' failed: Error: no package metadata for file {filename}

Steps to reproduce the behavior:

  1. Save any non .go file (for example a .json) inside a Go project.

Screenshots or recordings

Command 'gopls.package_symbols' failed: Error: no package metadata for file file:///{filepath}/{filename}.json.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions