Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify Go build flag "-H=windowsgui" in code comment

Tags:

windows

go

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?

like image 215
gonutz Avatar asked Jul 04 '16 15:07

gonutz


1 Answers

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.

like image 192
OneOfOne Avatar answered Nov 02 '22 20:11

OneOfOne