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

Integrate keyify with gopls #769

Open
dominikh opened this issue Jun 3, 2020 · 2 comments
Open

Integrate keyify with gopls #769

dominikh opened this issue Jun 3, 2020 · 2 comments
Labels
gopls Work that aids or requires integration with gopls

Comments

@dominikh
Copy link
Owner

dominikh commented Jun 3, 2020

We should integrate our keyify tool with gopls, and deprecate/remove the command-line tool. gopls comes with a check for unkeyed composite literals in golang.org/x/tools/go/analysis/passes/composite/composite.go, and we could improve that one to offer a suggested fix.

We would also like to offer keyification for struct literals that aren't flagged by the composite pass (because the type and its instantiation occur in the same package). This would tie into our planned set of quickfix checks.

Before we can do this, we should probably fix #185 first. We also need to figure out where the keyification logic should live.

  • If it lives only in our repository, then an analysis pass in x/tools would have to depend on us.
  • If it lives only in x/tools, then it would have to be exported so that we can reuse it in quickfix.
  • The code may be straightforward enough to copy into both projects.

/cc @stamblerre in case she has any input.

@dominikh dominikh added the gopls Work that aids or requires integration with gopls label Jun 3, 2020
@stamblerre
Copy link

  • If it lives only in our repository, then an analysis pass in x/tools would have to depend on us.

That's fine for us! We can do the usual deduplication logic and prefer the staticcheck version of the analysis. Also totally fine to put it in x/tools and put the suggested fix in the existing analysis. I don't really have a strong preference either way.

/cc @matloob

@matloob
Copy link

matloob commented Jun 5, 2020

I'm okay with adding it as a pass in x/tools, or not, whichever works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Work that aids or requires integration with gopls
Projects
None yet
Development

No branches or pull requests

3 participants