Add library to parse version info from a windows PE executable There are issues with go-git, will change to a wrapper library
20 lines
347 B
Go
20 lines
347 B
Go
package main
|
|
|
|
import (
|
|
"github.com/jdferrell3/peinfo-go/peinfo"
|
|
)
|
|
|
|
func getPEFileVersion(filepath string) string {
|
|
f, err := peinfo.Initialize(filepath, false, "", false)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
defer f.OSFile.Close()
|
|
defer f.PEFile.Close()
|
|
v, _, err := f.GetVersionInfo()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v["FileVersion"]
|
|
}
|