Delve Go Debugger fails because of large code in CDKTF Datadog Dashboard package

Hi Team,

I am using cdktf Go bindings to create some Dashboards on Datadog. While the code is working fine if I try to do the debugging using VS code and Delve debugger it fails with below error:

cdk.tf/go/stack/generated/DataDog/datadog/dashboard

:1: internal compiler error: NewBulk too big: nbit=85658 count=827225 nword=2677 size=2214481325

I was able to resolve this issue by creating an executing binary and then debugging directly which is optimized binary but this is a hassle as every time we need to create a binary for debugging to happen and also optimized binaries are not recommended since they may have missing or wrong variable values. I also saw this issue on Go’s github forum: cmd/compile: "internal compiler error: NewBulk too big" while running a program with dlv · Issue #56120 · golang/go · GitHub. This issue talks about similar condition but for AWS.

I would like to know if there is a way around here because this makes using Go quite unreliable for CDKTF. It seems this issue is coming because Delve runs the build command with a command like this go build --gcflags="all=-N -l" main.go . Because of the gcflags -N -l it creates non-optimized binary and it fails because code in dashboard package for datadog cdktf go provider is just too big.

We are also considering using cdktf Go for AWS infra but this issue makes me think if we should do that?

Hi @Jeet007 :wave:

parts of that size might come from how JSII (the underlying technology used by all CDKs) works and the sheer size of the AWS Terraform provider.

That said, we’d still like to investigate if we can improve this. Could you file a bug for this in our main repository on Github?

– Ansgar

Hi @ansgarm ,

Here are few already open github issues:
cmd/compile: "internal compiler error: NewBulk too big" while running a program with dlv · Issue #56120 · golang/go · GitHub.

My issue is similar but related to Datadog dashboards resoource. My question is , should I not use the GO for cdktf and stick to typescript given these issues?