How do I create an executable from Golang that doesn’t open a console window when run?

The documentation found online says I can compile with something along the lines of,

go build -ldflags -Hwindowsgui filename.go

But this gives an error: unknown flag -Hwindowsgui

With more recent (1.1?) versions of the compiler, this should work:

go build -ldflags -H=windowsgui filename.go

When I continued searching around I found a note that the official documentation should be updated soon, but in the meantime there are a lot of older-style example answers out there that error.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)