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: suggests invalid package names #44680

Open
seankhliao opened this issue Feb 28, 2021 · 1 comment
Open

x/tools/gopls: suggests invalid package names #44680

seankhliao opened this issue Feb 28, 2021 · 1 comment

Comments

@seankhliao
Copy link
Contributor

@seankhliao seankhliao commented Feb 28, 2021

go: tip
gopls: v0.6.6

With module / directory names with - in them, gopls uses that directly as a suggested package name, which is invalid

2021-02-28-115235

@gopherbot gopherbot added this to the Unreleased milestone Feb 28, 2021
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v1.0.0 Feb 28, 2021
@stamblerre stamblerre added this to To Do in gopls: v1.0.0 Feb 28, 2021
@ShoshinNikita
Copy link

@ShoshinNikita ShoshinNikita commented Apr 5, 2021

We can replace - with _. But there are other cases:

  • directory name starts with a digit
  • directory name contains one of these characters: -, . or ~
  • directory name contains invalid characters (whitespace, comma, etc.)

I think we can ignore the last case and don't show suggestions at all because it's not possible to import such packages (https://golang.org/ref/mod#go-mod-file-ident). But what is the expected behavior in other situations?

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

Successfully merging a pull request may close this issue.

None yet
4 participants