go: x/tools/gopls: spurious errors from template files (umbrella issue)
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
- Run
go versionto get version of Go from the VS Code integrated terminal.- <Paste go version here>
- Run
gopls -v versionto get version of Gopls from the VS Code integrated terminal.- <Paste gopls version here>
- Run
code -vorcode-insiders -vto get version of VS Code or VS Code Insiders.- <Paste VS Code version here>
- Check your installed extensions to get the version of the VS Code Go extension
- <Paste Go extension version here>
- Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Toolscommand.- <Paste the output here>
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.
Describe the bug
A clear and concise description of what the bug. A clear and concise description of what you expected to happen.
Steps to reproduce the behavior:
- Go to ‘…’
- Click on ‘…’
- See error
Screenshots or recordings
If applicable, add screenshots or recordings to help explain your problem.
I’m using Go 1.17 in Windows 10 64
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (8 by maintainers)
Commits related to this issue
- internal/lsp: honor the file kind provided by clients for overlays Honor the file kind provided by clients for overlays, by passing the FileHandle into View.FileKind and checking for overlays. For g... — committed to golang/tools by findleyr 2 years ago
- internal/lsp: find templates based on file kind Now that we honor the template file kind provided by LSP clients, we need to use this to derive the set of active templates. For golang/vscode-go#1957... — committed to golang/tools by findleyr 2 years ago
- internal/lsp/template: remove the skipTemplate guard Having the explicit skipTemplate guard should not be necessary, since with templateExtensions empty we should not detect any templates that the us... — committed to golang/tools by findleyr 2 years ago
- gopls: change the default value for templateExtensions to be empty There is no standard for go template file extensions, and users may not want this functionality. Make template support opt-in by cha... — committed to golang/tools by findleyr 2 years ago
Development of Gitea is also affected by this. Is there any way of excluding linting of individual template files or even directories? We have some template files which aren’t even intended to be go templates and it’s even linting files within vendor and probably in node_modules.
Unfortunately:
Is ignored by the template linter and disappointingly it seems like the only solution at present to prevent missing other more serious go errors is to simply turn off template linting through: