How do you set the application icon in golang?

前端 未结 5 888
抹茶落季
抹茶落季 2021-01-30 09:14

I\'ve just created my first go application on Windows.

How do I give it an icon?

There doesn\'t seem to be any build flags to do this, and I know golang doesn\'t

5条回答
  •  遥遥无期
    2021-01-30 10:04

    None of the above answers worked for me. The only way I could get an ico embedded into a GO exe was with Resource Hacker.

    http://www.angusj.com/resourcehacker/

    1. Install and open Resource Hacker
    2. Open compiled exe in Resource Hacker
    3. Action > Add an image or other binary resource
    4. Select ICO > Add Resource
    5. Save and Close

    You can also run it directly from the command line if you need to add it to your build scripts.

    ResourceHacker -open main.exe -save output.exe -action addskip -res main.ico -mask ICONGROUP,MAIN,
    

提交回复
热议问题