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: consider auto-detecting the module to provide -local without a config #40660

Open
stamblerre opened this issue Aug 10, 2020 · 2 comments

Comments

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Aug 10, 2020

See the conversation on #31999 and #32049.
Could we add some special value of the setting and have it automatically infer the name of the current module? For use cases where -local is not necessarily the path of current module, we could still allow a configuration as before.

/cc @heschik

@segevfiner
Copy link
Contributor

@segevfiner segevfiner commented Aug 10, 2020

Just note that what goimports needs is a prefix. So if your package is something like github.com/segevfiner/magicgopher, then it needs to be set too github.com/segevfiner. It is also actually a comma-separated list for some more complex cases, so having a setting for it is still definitely useful. Though honestly, goimports should have detected a config file in the repository root or something (Which gopls would also support), so such a setting like that is shared across devs and different code editors without them having to set it up themselves or depend on some specific editor configuration sharing facility.

@heschik
Copy link
Contributor

@heschik heschik commented Aug 10, 2020

I personally wish -local had never been added. (@bradfitz may have his own opinion.) I don't particularly want to encourage its adoption. We're definitely not going to create a goimports config file without a much more compelling reason.

A setting that automatically sets -local from the module prefix is still a problem for anyone that works on some projects that use -local and some that don't. I would want there to be more demand before we considered adding it.

@stamblerre stamblerre removed this from the gopls/v1.0.0 milestone Aug 10, 2020
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
4 participants
You can’t perform that action at this time.