How to detected if the binary is built with "-H windowsgui" so it is a windows GUI binary

Hi
I want to detect if the binary is built with “-H windowsgui”, so it should proceed with GUI, otherwise the console logic will be proceeded.

So I can handle GUI and CLI logic of my app in one place (that works good on Linux and Darwin) and I can built it twice for windows:
go build -ldflags="-H windowsgui" -o myapp.exe
go build -o myapp-cli.exe

Please help me

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.