Code generation in Go


I'm working on a plugin that should generate Go code. I did not manage to find good examples of code generating plugins that work with Go. But I found one that do it in Kotlin. It uses `org.jetbrains.kotlin.psi.KtPsiFactory` to create all PsiElements. I want to know if there is similarly working factory for Go PsiElements? Or you probably can point a different approach? It would be great if you could share some example.

1 comment

Hi Nikolay,

Thank you for contributing and your interest in the IntelliJ plugin development ecosystem.

A good entry point would be: (at the bottom there are a few open-source examples).

Other examples are the following:

- (generates something according to PSI)

- (example of a complex plugin)

In Go, an alternative to org.jetbrains.kotlin.psi.KtPsiFactory is com.goide.psi.impl.GoElementFactory which provides similar entrypoints.


Please sign in to leave a comment.