I use go build
to build a exe
file.Then i view the property of the file(Right click the file -> property),In detail
tab,the file's version is empty.
How i to set the version of the exe
file.
The EXE file version and other info are embedded as resources, which are specific to Windows and thus not supported by the Go compiler. You can use the package GoVersionInfo to accomplish this (it also supports embedding an icon). I haven't tried it myself, but it looks promising and well documented.
There is go-winres which lets you do this, either before or after go build
.
Run go install github.com/tc-hib/go-winres@latest
to install it.
Then, inside your project folder, run go-winres init
. This creates a subfolder named winres
.
Modify winres/winres.json
, and replace the icon.
Run go-winres make
. This creates a .syso
file.
Run go build
and see the result.
If you want to add a language, there's an example in the readme file. I didn't manage to do it with goversioninfo
, while it works with go-winres
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With