To compile a Windows GUI app in Go, you need to specify an extra flag during when running go build
:
go build -ldflags -H=windowsgui filename.go
When you do this, the application is compiled as a so-called "GUI binary" instead of as a "console binary". This means that when you start the app, it will run but it will not show up in the Windows taskbar.
The -ldflags
is used to specify the arguments to pass on each go tool link
invocation. A complete list can be found here.