windows

package
v0.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package windows handles Windows-specific build steps — currently the .syso resource that embeds the brand icon plus version metadata into the .exe. Compiles on every host (no Windows-only deps), so cross-builds from mac/linux still produce a metadata-rich .exe.

Index

Constants

This section is empty.

Variables

View Source
var ErrSkippedMSI = errors.New("msi: wixl not found on PATH")

ErrSkippedMSI is returned when MSI creation is skipped because the host has no usable MSI builder on PATH (`wixl` from msitools). Callers may treat this as a non-fatal warning — the .exe alone is still a valid distributable.

Functions

func EmbedResource

func EmbedResource(outputPath, appName, appVersion string) (func(), error)

EmbedResource generates a COFF .syso resource alongside main.go so the next `go build` for GOOS=windows picks up the brand W icon plus version metadata (FileDescription, FileVersion, ProductName, etc.).

Returns a cleanup func the caller defers — once `go build` finishes, the temporary .ico and the rsrc_windows_<arch>.syso file are removed.

outputPath is used only as the OriginalFilename hint inside the version resource; nothing is written there.

func PackageMSI added in v0.8.3

func PackageMSI(exePath, gateExePath, appName, appVersion, goarch string) (string, error)

PackageMSI wraps a freshly compiled .exe into a Windows Installer .msi package via `wixl` (msitools).

The MSI is always per-user: installs to %LocalAppData%\Programs\<AppName>\<AppName>.exe, registers a Start Menu shortcut and an Add/Remove Programs entry, and never adds the app to autostart (that stays an in-app toggle). Per-user matters because it skips the UAC prompt and — critically — leaves the .exe in a location the running app can rewrite, so the in-app self-updater keeps working on installed builds the same way it works on portable .exe builds.

gateExePath (optional) is the gate sidecar to ship as `<AppName>-gate.exe` next to the main .exe. Empty = no sidecar (the main .exe still has the gate binary embedded via //go:embed, extract-on-demand). When non-empty, the runtime resolution prefers the on-disk sibling over the embed extract — visible in Programs folder for the operator, no per-session extract churn.

Returns the .msi path on success; returns ErrSkippedMSI when wixl is not on PATH (mirrors the darwin .dmg skip pattern so cross-builds from hosts without wixl still produce a usable .exe).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL