Overview
Currently the update system has some fragile version handling patterns that could be improved.
Priority: Low - System works correctly, but could be more maintainable and robust.
Current Issues
-
Asset Name Brittleness: We manually construct expected asset names but GoReleaser generates versioned names like wt_0.4.0_Darwin_all.tar.gz. Our matching logic uses string manipulation workarounds.
-
Binary Name Inconsistency: We support both wt-bin (development name) and worktree-utils (release name) which creates confusion and maintenance overhead.
-
Platform Detection: Manual OS/arch mapping that could leverage existing Go tooling.
-
Version Comparison: Basic string comparison instead of semantic versioning.
Suggested Improvements
1. Standardize Asset Naming
- Use GoReleaser naming patterns consistently
- Or configure GoReleaser to match our expected patterns
- Consider using GitHub API dynamic asset discovery
2. Unify Binary Names
- Choose one canonical name (probably
wt-bin for consistency)
- Update GoReleaser config to use consistent binary name
- Remove dual binary name support after transition
3. Use Semantic Versioning Library
- Replace manual version comparison with proper semver
- Handle pre-release versions, build metadata correctly
- Examples:
github.com/Masterminds/semver/v3 or golang.org/x/mod/semver
4. Learn from Established Tools
- Study how
gh, docker, kubectl handle updates
- Consider using update frameworks like
go-github for releases
Current Workarounds
The update system currently works with these workarounds:
strings.HasSuffix(a.Name, "_"+assetName[3:]+".tar.gz") for versioned assets
base == "wt-bin" || base == "worktree-utils" for binary names
Benefits of Fixing
- More maintainable update code
- Reduced fragility when changing release processes
- Better error messages for users
- Preparation for more complex update scenarios (checksums, signatures, etc.)
Overview
Currently the update system has some fragile version handling patterns that could be improved.
Priority: Low - System works correctly, but could be more maintainable and robust.
Current Issues
Asset Name Brittleness: We manually construct expected asset names but GoReleaser generates versioned names like
wt_0.4.0_Darwin_all.tar.gz. Our matching logic uses string manipulation workarounds.Binary Name Inconsistency: We support both
wt-bin(development name) andworktree-utils(release name) which creates confusion and maintenance overhead.Platform Detection: Manual OS/arch mapping that could leverage existing Go tooling.
Version Comparison: Basic string comparison instead of semantic versioning.
Suggested Improvements
1. Standardize Asset Naming
2. Unify Binary Names
wt-binfor consistency)3. Use Semantic Versioning Library
github.com/Masterminds/semver/v3orgolang.org/x/mod/semver4. Learn from Established Tools
gh,docker,kubectlhandle updatesgo-githubfor releasesCurrent Workarounds
The update system currently works with these workarounds:
strings.HasSuffix(a.Name, "_"+assetName[3:]+".tar.gz")for versioned assetsbase == "wt-bin" || base == "worktree-utils"for binary namesBenefits of Fixing