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

proposal: go/parser: extending go compiler for custom compile-time checks #60660

Closed
nicchongwb opened this issue Jun 7, 2023 · 1 comment
Closed
Labels
Milestone

Comments

@nicchongwb
Copy link

Currently, we use the go binary to compile and build our projects. Will introducing extensible APIs to perform customised checks on compile-time data structures (eg. AST, IR) be inline with what Go is design to be?

In Java/Kotlin, we are able to develop custom compiler plugins that can be autoserviced during compile time by javac or kotlinc. One use case of such a capability is to manipulate the IR (intermediate representation) before bytecode/machine code generation. Another use case is to perform custom checks on the program context during compile time (as compared to static code analysis).

Maybe another challenge for this, is the consideration of how such compiler plugins will function with Go's native binary and build tool process.

@gopherbot gopherbot added this to the Proposal milestone Jun 7, 2023
@ianlancetaylor
Copy link
Contributor

I'm sorry, this is not a direction that we are going to follow. The compiler IR is unstable and we aren't going to commit to stability for the benefit of compiler plugins.

For static analysis purposes, we already have extensive tooling that is not part of the compiler. See https://pkg.go.dev/golang.org/x/tools/go/analysis .

@ianlancetaylor ianlancetaylor closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants