I am creating a desktop Windows application in Go. Currently I use this line to install it:
go install -ldflags -H=windowsgui
I want users to be able to just say
go get github.com/my/app
and automatically have the windowsgui
flag specified for building. Is it possible to add the flag as a code comment, like #cgo
comments. Or would I have to provide a make
file in the project directory like in the old days of Go? Or is it not possible at all?
Bad news, you can't.
Semi-good news, you can tell your users to use go get -ldflags "-H windowsgui" github.com/my/app
on Windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With