Execute CDK From golang file?

I want to call functions like cdk diff and cdk synth from within my main.go.

I’m looking for the cdk equivalent of terraform fexec

Is this possible?

It is possible to call the cli from an application by launching a separate process; however, there isn’t currently a programmatic api for accessing it. See API to interact with terraform cli · Issue #237 · hashicorp/terraform-cdk · GitHub.

One thing to note when launching the cli is to make sure it is a separate application to you cdktf app as the cli launches the app.