安装依赖
go get github.com/akavel/rsrc
示例代码main.go
//go:generate rsrc -ico resource/icon.ico -manifest resource/goversioninfo.exe.manifest -o main.syso
package main

import (
	"os/exec"
)

func main() {
	cmd := exec.Command("cmd", "/C", "start https://www.baidu.com")
	if err := cmd.Run(); err != nil {
		panic(err)
	}
}

示例代码goversioninfo.exe.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity type="win32" name="demo" version="1.0.0.0" processorArchitecture="*"/>
</assembly>
注意事项
//go:generate rsrc -ico resource/icon.ico -manifest resource/goversioninfo.exe.manifest -o main.syso

上述代码直接放在main.go正文头部,syso文件名必须和go文件名一致,resource目录与main.go同级

测试
go generate
go build
go generatego generate