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 support resources.
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 support resources.
You can use a tool like akavel/rsrc in order to generate a .syso file with specified resources embedded in .rsrc
section, aimed for consumption by Go linker when building Win32 excecutables.
See as an example the lxn/walk application, which embeds other metadata in its executable.
rsrc [-manifest FILE.exe.manifest] [-ico FILE.ico[,FILE2.ico...]] -o FILE.syso
-ico=""
: comma-separated list of paths to .ico files to embed
This differs from embedding binary data into a go program.
For that, use jteeuwen/go-bindata.
To access asset data, we use the
Asset(string) []byte
function which is included in the generated output.
data := Asset("pub/style/foo.css")
if len(data) == 0 {
// Asset was not found.
}
// use asset data