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

stamblerre opened this issue Aug 10, 2020 · 3 comments


Copy link

@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

Copy link

@segevfiner segevfiner commented Aug 10, 2020

Just note that what goimports needs is a prefix. So if your package is something like, then it needs to be set too 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.

Copy link

@heschi heschi 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
@stamblerre stamblerre added this to the gopls/unplanned milestone Oct 21, 2020
Copy link

@michaelbeaumont michaelbeaumont commented Apr 14, 2021

Why exactly don't people want to encourage -local? It seems to be a very common pattern to have 3 groupings. Couldn't something like -local-mod be added, to be equivalent to goimports -local $(go list -m)

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

Successfully merging a pull request may close this issue.

None yet
5 participants