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: better handling of “scripts” with //go:build ignore? #49657

Open
ainar-g opened this issue Nov 18, 2021 · 1 comment
Open

x/tools/gopls: better handling of “scripts” with //go:build ignore? #49657

ainar-g opened this issue Nov 18, 2021 · 1 comment

Comments

@ainar-g
Copy link
Contributor

@ainar-g ainar-g commented Nov 18, 2021

I have a directory with several Go “scripts”. That is, files each of which has a //go:build ingore directive and its own main. Currently, gopls doesn't seem to handle this pattern very well, as when I add ignore to the list of tags, gopls is confused by several mains in what it sees as a single package.

Is there a way to make gopls treat such files as separate binaries?

Or, perhaps, there should be a separate marker build tag for these things, like //go:build run?

@gopherbot gopherbot added this to the Unreleased milestone Nov 18, 2021
@findleyr
Copy link
Contributor

@findleyr findleyr commented Nov 18, 2021

I think we've talked about this in the past; it would require making 'ignore' special, but that seems fine to me. We have a long-standing issue to improve handling of build tags (#29202), that this will probably be prioritized behind.

Or, perhaps, there should be a separate marker build tag for these things, like //go:build run?

I'd rather just have gopls understand ignore. There's plenty of code in the wild that uses this already. If this causes problems for anyone (because they use ignore to define multi-file packages), we can make it configurable. But I would be surprised if that happened.

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants