Search code examples
user-interfacegogoland

Running GUI apps in Goland IDE


When I build in Terminal, I can use a flag to say I want to build for GUI:

go build -ldflags="-H windowsgui"

However, I just started using JetBrains Goland and I don't how to run GUI apps. What can I do?


Solution

  • go build will only build the application.

    To actually run the application, you should go to Run | Edit Configurations... | + | Go Application and configure the application as you need.

    Here you will need to set two options:

    • add -ldflags="-H windowsgui" to the Go tool arguments option
    • configure the Output directory to be in the same directory as your .manifest file

    Setting the output directory is critical in order to run the the application without encountering the following panic panic: TTM_ADDTOOL failed described in this issue.

    Then you can run the configuration via Run | Run... and select the configuration you've just created.