Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a windowed setting option for the Go compiler?

I'm using Go (6g) to compile a GTK application and I want to know if there is a compiler/linker option to make it a Windows executable as opposed to console executable. MinGW has a -mwindows option for this and currently I'm having to manually alter the PE header with a hex editor which is annoying.

like image 481
Chris_F Avatar asked Jul 09 '12 09:07

Chris_F


People also ask

What is go build command?

go build command is generally used to compile the packages and dependencies that you have defined/used in your project. So how go build is executing internally, what compiler executes, which directories created or deleted; Those all questions are answered by go build command flags.


1 Answers

-ldflags 'flag list' arguments to pass on each 5l, 6l, or 8l linker invocation

Compile packages and dependencies

-Hwindowsgui (only in 6l/8l) Write Windows PE32+ GUI binaries

Command ld

Add -ldflags -Hwindowsgui to the go build/get/install command line. For example,

go build -ldflags="-Hwindowsgui" gtkapp.go
like image 184
peterSO Avatar answered Sep 17 '22 23:09

peterSO