这个不同将二进制数据嵌入到go程序中。

为此,请使用。
$ b



  data:=资产中的code>函数,它包含在生成的输出中。 (pub / style / foo.css)
如果len(数据)== 0 {
//资产未找到。
}

//使用资产数据


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.

.rsrc

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=""

This differs from embedding binary data into a go program.
For that, use jteeuwen/go-bindata.

data := Asset("pub/style/foo.css")
if len(data) == 0 {
    // Asset was not found.
}

// use asset data

这篇关于你如何在golang中设置应用程序图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!