在GoLand控制台中运行termbox-go应用

I want to create a Go app with a console UI using the termui library (which is built on top of the termbox-go library). I can build the app and run it from the command line, but it will not start inside the GoLand IDE (2018.1.3) on Windows 10.

It fails during the termbox-go init when calling syscall.Syscall with SetConsoleScreenBufferSize parameter. The size for the screen buffer is 80x25. Error message is just "The parameter is incorrect."

How can I debug a termbox-go app in the GoLand or other IDE?

I think the way to solve this is to build your executable with Go 1.10 or newer, compile it with the following flags: -gcflags="all=-N -l" (these are very important and will allow the debugger to work a lot better, and then use the Run | Attach to Local Process... option from GoLand and attach to the local process.

I'll see if I can replicate the bug and update this accordingly.