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: add support for code generation #31817

Closed
myitcv opened this issue May 3, 2019 · 2 comments
Closed

x/tools/gopls: add support for code generation #31817

myitcv opened this issue May 3, 2019 · 2 comments
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.

Comments

@myitcv
Copy link
Member

myitcv commented May 3, 2019

Following a recent exchange with @ianthehat I thought I would create a tracking issue for adding integration/support/??? into gopls for code generation. I suspect this issue will be more of a dumping ground for ideas/thoughts right now, but can be closed/repurposed etc as and when.

A rough list of thoughts:

  • strong preference (requirement?) for any solution to be dependency aware, that is if I change a file X that is a (transitive) dependency of other packages, and those other packages are part of the main module, then code generation should also happen in those packages. This also helps those code generators that rely on type checking
  • code generators should be encouraged to be artefact cache-based
  • unclear when/how code generation should be triggered; on each file change is likely to be very expensive. Probably user initiated therefore?
  • should code generation be based solely on the contents of files on disk? Or, like gopls, represent the result of the editor's "overlay"?
  • how should generated files be identified? There is already a standard form comment for identifying generated files, but from a user's perspective (e.g. listing a directory contents) this is not as useful as (also) having a consistent file naming format, like a gen_ prefix. As far as tools are concerned, clearly it doesn't matter, but from a user's perspective, the file name approach is likely more useful
  • ...
@myitcv myitcv added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. gopls Issues related to the Go language server, gopls. labels May 3, 2019
@gopherbot gopherbot added this to the Unreleased milestone May 3, 2019
@myitcv myitcv removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 3, 2019
@myitcv
Copy link
Member Author

myitcv commented May 3, 2019

cc @stamblerre @mvdan @rogpeppe

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 8, 2019
@stamblerre stamblerre changed the title x/tools/cmd/gopls: code generation tracking issue x/tools/cmd/gopls: add support for code generation Jun 5, 2019
@stamblerre stamblerre changed the title x/tools/cmd/gopls: add support for code generation x/tools/gopls: add support for code generation Jul 2, 2019
@stamblerre stamblerre modified the milestones: Unreleased, gopls unplanned Dec 4, 2019
@stamblerre stamblerre added NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jan 29, 2020
@stamblerre stamblerre modified the milestones: gopls unplanned, Unreleased Jan 29, 2020
@stamblerre stamblerre removed this from the Unreleased milestone Jul 23, 2020
@stamblerre stamblerre added this to the gopls/unplanned milestone Oct 21, 2020
@findleyr
Copy link
Contributor

Gopls has had a go:generate code lens for a while, and honors the "DO NOT EDIT" comment. Closing this as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

5 participants