{"id":28092517,"url":"https://github.com/bi-zone/go-fileversion","last_synced_at":"2025-05-13T13:18:58.111Z","repository":{"id":46642534,"uuid":"203150381","full_name":"bi-zone/go-fileversion","owner":"bi-zone","description":"Go wrapper for querying windows version-information resource.","archived":false,"fork":false,"pushed_at":"2024-04-27T13:38:01.000Z","size":50,"stargazers_count":24,"open_issues_count":5,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-13T13:18:52.967Z","etag":null,"topics":["file-info","file-information","go","golang","version-info","versioninfo"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bi-zone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-19T10:24:42.000Z","updated_at":"2025-02-23T07:20:58.000Z","dependencies_parsed_at":"2022-09-07T17:02:03.386Z","dependency_job_id":null,"html_url":"https://github.com/bi-zone/go-fileversion","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bi-zone%2Fgo-fileversion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bi-zone%2Fgo-fileversion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bi-zone%2Fgo-fileversion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bi-zone%2Fgo-fileversion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bi-zone","download_url":"https://codeload.github.com/bi-zone/go-fileversion/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948510,"owners_count":21988962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-info","file-information","go","golang","version-info","versioninfo"],"created_at":"2025-05-13T13:18:57.495Z","updated_at":"2025-05-13T13:18:58.095Z","avatar_url":"https://github.com/bi-zone.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# go-fileversion\n\n[![GoDoc](https://godoc.org/github.com/bi-zone/go-fileversion?status.svg)](https://godoc.org/github.com/bi-zone/go-fileversion/)\n[![Go Report Card](https://goreportcard.com/badge/github.com/bi-zone/wmi)](https://goreportcard.com/report/github.com/bi-zone/go-fileversion)\n\nPackage `fileversion` provides wrapper for querying properties from windows version-information resource.\n\nUsing the package you can extract the following info:\n\n![properties example](./assets/explorer_properties.png)\n\nIf you are looking how to add this info to your go binary - look at [josephspurrier/goversioninfo](https://github.com/josephspurrier/goversioninfo).\n\n## Examples\n\nPrint version info from input file\n```golang\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/bi-zone/go-fileversion\"\n)\n\nfunc main() {\n\tif len(os.Args) \u003c 2 {\n\t\tlog.Fatalf(\"Usage: %s \u003cimage-path\u003e\", os.Args[0])\n\t}\n\tf, err := fileversion.New(os.Args[1])\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(\"ProductName:\", f.ProductName())\n\tfmt.Println(\"LegalCopyright:\", f.LegalCopyright())\n\tfmt.Println(\"Version:\", f.FixedInfo().FileVersion)\n}\n```\n\nAll string properties in file version-information resource by-design has multiple translations. \n`go-fileversion` allows you to query that translations in a 2 ways. \n\nYou can create an `Info` object with \"preferred\" locale:\n\n```golang\ngermanLocale := fileversion.Locale{\n    LangID: 0x0407, // langID German\n    CharsetID: fileversion.CSUnicode,\n}\nf, err := fileversion.NewWithLocale(os.Args[1], germanLocale)\nif err != nil {\n    log.Fatal(err)\n}\nfmt.Println(\"ProductName:\", f.ProductName())\n```\n\nHere \"German-Unicode\" locale will be used to query string properties (like `ProductName`), \n**but if the german translation will be missing - `go-fileversion` would try to fetch a \nproperty with default translation**. (The idea of locales handling was copied from \n[.NET Framework 4.8](https://referencesource.microsoft.com/#System/services/monitoring/system/diagnosticts/FileVersionInfo.cs,036c54a4aa10d39f,references))\n\nThe only way to get necessary translation without any heuristics is to use `GetPropertyWithLocale` manualy:\n```golang\nf, err := fileversion.New(os.Args[1])\nif err != nil {\n    log.Fatal(err)\n}\ngermanLocale := fileversion.Locale{\n    LangID: 0x0407, // langID German\n    CharsetID: fileversion.CSUnicode,\n}\nfmt.Println(f.GetPropertyWithLocale(\"ProductName\", germanLocale))\n```\n\n## Versioning\n\nProject uses [semantic versioning](http://semver.org) for version numbers, which\nis similar to the version contract of the Go language. Which means that the major\nversion will always maintain backwards compatibility with minor versions. Minor \nversions will only add new additions and changes. Fixes will always be in patch. \n\nThis contract should allow you to upgrade to new minor and patch versions without\nbreakage or modifications to your existing code. Leave a ticket, if there is breakage,\nso that it could be fixed.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbi-zone%2Fgo-fileversion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbi-zone%2Fgo-fileversion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbi-zone%2Fgo-fileversion/lists"}