Categorygithub.com/bitfocus/syso
repositorypackage
0.0.1
Repository: https://github.com/bitfocus/syso.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

syso

godoc goreportcard

syso - tool for embedding various type of resources in go Windows executable

Table of contents:

Forked from hallazzang/syso

This project is forked from hallazzang/syso to support go install xxxx for installation of cli, as go get is deprecated.

Features

Featurersrcgoversioninfosyso(this project)
Embedding icons
Embedding manifest
Configuration through a file
Embedding version info
Embedding multilingual version info
Fixed resource identifier

Why fixed resource identifier matters?

Because you can easily load your resource in runtime. Other tools do not guarantee your resource to have same id across builds.

Installation

$ go install github.com/bitfocus/syso/cmd/syso@latest

Usage

Write a configuration file in JSON, which tells syso what resources you want to embed. Here's an example:

{
  "Icons": [
    {
      "ID": 1,
      "Path": "icon.ico"
    }
  ],
  "Manifest": {
    "ID": 2,
    "Path": "App.exe.manifest"
  }
}

You can specify name instead of id:

...
    {
      "Name": "MyIcon",
      "Path": "icon.ico"
    }
...

Save it as syso.json in project's directory and run the tool:

$ syso

This will generate out.syso in your current directory. You can now go build to actually include the resources in your executable.

Configuration

Configuration file is written in JSON format. Top-level configuration is an object that has three optional fields: Icon, Manifest, VersionInfos.

Here are details about configuration object types.

Icon

FieldTypeDescription
IDNumber
NameString
PathStringIcon file path

Manifest

FieldTypeDescription
IDNumber
NameString
PathStringManifest file path

VersionInfo

FieldTypeDescription
IDNumber
NameString
FixedVersionInfoFixedLanguage-independent information
StringTables[]VersionInfoStringTableLanguage-specific string information
Translations[]VersionInfoTranslationLanguage and charset pairs which application supports
VersionInfoFixed
FieldTypeDescription
FileVersionStringFormat: "Major.Minor.Patch.Build"
ProductVersionStringFormat: "Major.Minor.Patch.Build"

VersionInfoStringTable

FieldTypeDescription
LanguageString(Required) String table's language, in hex
CharsetString(Required) String table's charset, in hex
StringsVersionInfoStrings(Required) Actual string table

VersionInfoStrings

FieldTypeDescription
CommentsString
CompanyNameString
FileDescriptionString
FileVersionString
InternalNameString
LegalCopyrightString
LegalTradeMarksString
OriginalFilenameString
PrivateBuildString
ProductNameString
ProductVersionString
SpecialBuildString

VersionInfoTranslation

FieldTypeDescription
LanguageString(Required) Supported language, in hex
CharsetString(Required) Supported charset, in hex

Here's an example configuration:

{
  "Icons": [
    {
      "ID": 1,
      "Path": "icon.ico"
    },
    {
      "Name": "Icon",
      "Path": "icon2.ico"
    }
  ],
  "Manifest": {
    "ID": 1,
    "Path": "App.exe.manifest"
  },
  "VersionInfos": [
    {
      "ID": 1,
      "Fixed": {
        "FileVersion": "10.0.14393.0",
        "ProductVersion": "10.0.14393.0"
      },
      "StringTables": [
        {
          "Language": "0409",
          "Charset": "04b0",
          "Strings": {
            "CompanyName": "Microsoft Corporation",
            "FileDescription": "Windows Command Processor",
            "FileVersion": "10.0.14393.0 (rs1_release.160715-1616)",
            "InternalName": "cmd",
            "LegalCopyright": "\u00a9 Microsoft Corporation. All rights reserved.",
            "OriginalFilename": "Cmd.Exe",
            "ProductName": "Microsoft\u00ae Windows\u00ae Operating System",
            "ProductVersion": "10.0.14393.0"
          }
        }
      ],
      "Translations": [
        {
          "Language": "0409",
          "Charset": "04b0"
        }
      ]
    }
  ]
}

Note that keys are case-insensitive. You can use both "companyName" and "CompanyName", or even "companyname" for key.

License

MIT