From 0b69df6e9351da8a4dfaa22fe1195dfa3860abf3 Mon Sep 17 00:00:00 2001 From: Snider Date: Mon, 2 Feb 2026 02:18:08 +0000 Subject: [PATCH 1/2] fix(updater): resolve PkgVersion duplicate declaration Remove var PkgVersion from updater.go since go generate creates const PkgVersion in version.go. Track version.go in git to ensure builds work without running go generate first. Co-Authored-By: Claude Opus 4.5 --- internal/cmd/updater/.gitignore | 1 - internal/cmd/updater/version.go | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 internal/cmd/updater/version.go diff --git a/internal/cmd/updater/.gitignore b/internal/cmd/updater/.gitignore index eddd0225..6f586324 100644 --- a/internal/cmd/updater/.gitignore +++ b/internal/cmd/updater/.gitignore @@ -1,6 +1,5 @@ # Go updater -version.go *.exe *.exe~ *.dll diff --git a/internal/cmd/updater/version.go b/internal/cmd/updater/version.go new file mode 100644 index 00000000..3376963c --- /dev/null +++ b/internal/cmd/updater/version.go @@ -0,0 +1,5 @@ +package updater + +// Generated by go:generate. DO NOT EDIT. + +const PkgVersion = "1.2.3" From f49155745a4c92855a1966ab0dc07b2c839c814e Mon Sep 17 00:00:00 2001 From: Snider Date: Mon, 2 Feb 2026 04:20:26 +0000 Subject: [PATCH 2/2] build: add release build tasks with linker flags for smaller binary Add -s -w linker flags to strip debug info and symbol table: - cli:build:release - release build to ./bin/core - cli:install:release - release install to system PATH Binary size reduced from 19MB to 14MB (26% reduction). Fixes #226 Co-Authored-By: Claude Opus 4.5 --- Taskfile.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index de548953..d4379901 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -3,20 +3,35 @@ version: '3' vars: VERSION: sh: git describe --tags --exact-match 2>/dev/null || echo "dev" - LDFLAGS: "-X github.com/host-uk/core/pkg/cli.AppVersion={{.VERSION}}" + # Base ldflags for version injection + LDFLAGS_BASE: "-X github.com/host-uk/core/pkg/cli.AppVersion={{.VERSION}}" + # Development build: includes debug info + LDFLAGS: "{{.LDFLAGS_BASE}}" + # Release build: strips debug info and symbol table for smaller binary + LDFLAGS_RELEASE: "-s -w {{.LDFLAGS_BASE}}" tasks: # --- CLI Management --- cli:build: - desc: "Build core CLI to ./bin/core" + desc: "Build core CLI to ./bin/core (dev build with debug info)" cmds: - go build -ldflags '{{.LDFLAGS}}' -o ./bin/core . + cli:build:release: + desc: "Build core CLI for release (smaller binary, no debug info)" + cmds: + - go build -ldflags '{{.LDFLAGS_RELEASE}}' -o ./bin/core . + cli:install: - desc: "Install core CLI to system PATH" + desc: "Install core CLI to system PATH (dev build)" cmds: - go install -ldflags '{{.LDFLAGS}}' . + cli:install:release: + desc: "Install core CLI for release (smaller binary)" + cmds: + - go install -ldflags '{{.LDFLAGS_RELEASE}}' . + # --- Development --- test: desc: "Run all tests"