-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: consider supporting script directories with multiple programs #41206
Comments
Most single files intended for use with |
Previous discussion: #33595 |
Looking at the arguments against this, if someone can come up with a good enough name for the file that contains the build-ignore The counter argument to this is that there is lots of preexisting code out there that does following the single-file approach. |
I think this would work reasonably well. I think it would have covered nearly all the times I've encountered gopls to error in this way.
While I see the point, I disagree. There's nothing wrong with build-tag-ignored one-off programs being part of an existing package. An extra directory with just one file will be more verbose, and an oddity that has never been needed in Go before. Coming up to all those users and telling them they need to change their workflow just to please gopls, and objectively for no other good reason, seems like it won't end well :) |
I don't think this idiom is very common, but apart from the This excludes Go files as per-file ignore would, but still keeps them usable with I haven't checked it with the newer versions of gopls, but |
Currently,
gopls
only supports directories with a single main, no matter whether you open a single file or a directory. For single files, we load the entire directory, no matter what. Some users create directories with multiple mains, which they run usinggo run file.go
. Shouldgopls
support such directories? If so, how should it work?The text was updated successfully, but these errors were encountered: