Skip to content

Shrink binary by replacing Helm engine dependency - #20

Merged
digitalstudium merged 1 commit into
digitalstudium:mainfrom
DanielHabenicht:optimize-go-build
Aug 1, 2026
Merged

Shrink binary by replacing Helm engine dependency#20
digitalstudium merged 1 commit into
digitalstudium:mainfrom
DanielHabenicht:optimize-go-build

Conversation

@DanielHabenicht

Copy link
Copy Markdown
Contributor

As written in #16 (comment)

This would reduce the binary size substantially and allow for easier multi version support (and also adding support for helmfile syntax in a similar way).

Down side is that it has to be maintained separately instead of just using the dependeny.

I added -trimpath to allow future builds to be identical wherever they are build (so sha's should be the same across different build devices)

The Helm template engine was imported solely to borrow its funcMap for
parse-time syntax validation, pulling in ~169 helm.sh/k8s.io packages and
dominating the binary (~38 MB). Reimplement the same function set locally
from Sprig plus no-op placeholders for Helm's own additions, matching
helm.sh/helm/v3/pkg/engine.funcMap (v3.19.0). This drops all Helm/k8s
dependencies and shrinks the linux/amd64 binary to ~5.5 MB.

Add -trimpath to the goreleaser build for reproducible, path-free binaries,
and add tests asserting every Helm/Sprig function name still validates.
@digitalstudium
digitalstudium merged commit 8f96ea9 into digitalstudium:main Aug 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants