This is a creation in Article, where the information may have evolved or changed.
It's a pleasure to add icons to your own compiled programs. Here's how to add an icon to the Go program on the Windows platform:
- First you need to prepare the icon files, such as Myapp.ico.
- Second, prepare a generic ico.manifest program description file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"><assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="SomeFunkyNameHere" type="win32"/><dependency><dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/></dependentAssembly></dependency><asmv3:application><asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"><dpiAware>true</asmv3:windowsSettings></asmv3:application></assembly>
Execute "Go get github.com/akavel/rsrc" to download the source code of SYSO File Generator tool and compile and install using "Go Install"
Execute "rsrc.exe-manifest ico.manifest-o myapp.syso-ico Myapp.ico" to generate the resource file Myapp.syso
Copy Myapp.syso to your own project directory, it is best to specify the directory to compile the system (such as "xxx_windows"), and the directory should be import into the project, and then the normal compiler can automatically add icons