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: processes /tmp/output as a go file because vscode says it is a go file #50386

Open
pjweinb opened this issue Dec 29, 2021 · 2 comments
Labels
gopls Issues related to the Go language server, gopls. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Tools This label describes issues relating to any tools in the x/tools repository.

Comments

@pjweinb
Copy link

pjweinb commented Dec 29, 2021

gopls version

at tip:

Build info

golang.org/x/tools/gopls master
golang.org/x/tools/gopls@(devel)
github.com/BurntSushi/toml@v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw=
github.com/google/go-cmp@v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
golang.org/x/mod@v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38=
golang.org/x/sync@v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sys@v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0=
golang.org/x/text@v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/tools@v0.1.7 => ../
golang.org/x/xerrors@v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
honnef.co/go/tools@v0.2.1 h1:/EPr//+UMMXwMTkXvCCoaJDq8cpjMO80Ou+L4PDo2mY=
mvdan.cc/gofumpt@v0.1.1 h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA=
mvdan.cc/xurls/v2@v2.3.0 h1:59Olnbt67UKpxF1EwVBopJvkSUBmgtb468E4GVWIZ1I=

I opened a text file /tmp/output, vscode thinks it is a Go file (in the status line at the bottom)
gopls then tries to process it as a go file, getting errors for imports, code_actions, semantic tokens, etc.

Perhaps gopls should not trust the client's decisions on file types.

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Dec 29, 2021
@gopherbot gopherbot added this to the Unreleased milestone Dec 29, 2021
@findleyr
Copy link
Contributor

findleyr commented Jan 4, 2022

I'd guess we'll have other problems for (valid) go files that do not have a .go file extension. Maybe we can just ignore what the client says? But I'm a bit concerned about unknown workflows that may break, for example some sort of scratch buffer usage. It seems more correct to fix the client.

@findleyr findleyr added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jan 4, 2022
@findleyr findleyr modified the milestones: gopls/unplanned, Unreleased Jan 4, 2022
@findleyr
Copy link
Contributor

findleyr commented Jan 7, 2022

From discussion:

It is not pragmatic for us to handle Go files that don't end in .go, because of integrations with external tools. However, it may be helpful to at least add a diagnostic to files that the client tells us are Go file, but don't end in .go. Something like "Go files must use the ".go" file extension".

Doing this is not entirely trivial, and is a relatively low priority, so this probably won't get done anytime soon.

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. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants