-1

I have a project that works across all os (windows, macos, Linux, freeBSD). However when the binary is built, and run on windows, the command prompt opens up with it. I would like to automatically add -ldflag -H=windowsgui as an argument to go build but I am not sure how to add it

1 Answer 1

2

I usually use a bat file for that!

go build -v -o main.exe -ldflags -H=windowsgui
main.exe

Then I just run build.bat .

For other OSes, you could use a .sh script similar to this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.