update-install
Build treetop from the current checkout and reinstall it via the repo Makefile on Linux or macOS. Use when the user wants to update, refresh, or reinstall their local treetop with the latest build from source (e.g. after merging a fix), rather than waiting for a tagged release.
- License 许可
- MIT
- 所属仓库
- snag-run/treetop
- 最近更新
- 2026-09-12
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- update-install
- description
- Build treetop from the current checkout and reinstall it via the repo Makefile on Linux or macOS. Use when the user wants to update, refresh, or reinstall their local treetop with the latest build from source (e.g. after merging a fix), rather than waiting for a tagged release.
03 SKILL.md 正文
Update the local treetop install
Rebuild treetop from the current source tree using the repo Makefile, then
reinstall it with the project's supported source-install path. Works the same on
Linux and macOS.
This installs an unreleased dev build straight from source. For a tagged release, download the prebuilt binary from the GitHub release instead.
Steps
-
Install from the repo root (you must be inside the treetop checkout):
make installmake installdelegates togo install ., so it builds the current checkout and installstreetopinto Go's bin directory. If it fails, stop and surface the error. -
Find the install target so you know where the new binary landed:
BIN_DIR="$(go env GOBIN)" if [ -z "$BIN_DIR" ]; then GOPATH="$(go env GOPATH)" BIN_DIR="${GOPATH%%:*}/bin" fi TARGET="$BIN_DIR/treetop" -
Check which binary the shell will run:
command -v treetopIf this does not match
$TARGET, the install succeeded but the shell is still resolving some othertreetopearlier onPATH. Report both paths back to the user. Do not silently overwrite the other binary; that is now outside the Makefile-managed flow. -
Verify the new binary is live:
treetop --versionA source build stamps a pseudo-version from Go's VCS build info, like
v0.2.1-0.20260627222925-71b992a2a45a— the trailing short commit (71b992a) is theHEADyou built from, so it confirms the update took. It only falls back totreetop devwhen the build carries no VCS info (built outside the git checkout, or with-buildvcs=false). Also report the resolved binary path (command -v treetop) back to the user.
Platform notes
make installuses Go's install location, not/usr/local/bin.- If
GOBINis set, the binary lands in$GOBIN/treetop. - Otherwise it lands in the
bindirectory under the first path entry fromgo env GOPATH, which is typically$HOME/go/bin/treetop. - If that directory is not on
PATH, the install can succeed whiletreetopstill resolves to an older copy elsewhere. - The version string comes from Go build info (
main.go): a plaingo buildin the checkout already stamps the commit as a pseudo-version, so no extra-ldflagsare needed for a local install. Tagged release builds carry a realvX.Y.Zinstead.