最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How do I version my go executable for windows? - Stack Overflow

programmeradmin1浏览0评论

I have a problem versioning my Windows executables created with go.

Here is my main.go

package main

import (
    "fmt"
)

func main() {
    fmt.Println("hello world")
}

Here is winres/winres.json:

{
    "RT_VERSION": {
      "#1": {
        "0000": {
          "fixed": {
            "file_version": "1.0.250651.0",
            "product_version": "1.0.250651.0"
          }
        }
      }
    }
  }

Here is my go.mod

module helloworld

go 1.24

And here is my build script I run in git bash on my windows laptop:

#!/bin/bash
go-winres make
GOOS=windows GOARCH=amd64 go build
powershell.exe -Command "[System.Diagnostics.FileVersionInfo]::GetVersionInfo(\"helloworld.exe\")"

Unfortunately, this is the output:

ProductVersion   FileVersion      FileName
--------------   -----------      --------

So I created syso files based version info but apparently, my build does not include it in the right way to make sure my executable is correctly versioned.

What am i doing wrong? Executables and syso files are created. So I really do not understand. Help me solving this.

发布评论

评论列表(0)

  1. 暂无评论