| Crates.io | go-updater |
| lib.rs | go-updater |
| version | 0.1.0 |
| created_at | 2025-12-18 05:57:35.222145+00 |
| updated_at | 2025-12-18 05:57:35.222145+00 |
| description | Simple CLI to check and update Go (Golang) installations on Linux. |
| homepage | https://github.com/christiandoxa/go-updater |
| repository | https://github.com/christiandoxa/go-updater |
| max_upload_size | |
| id | 1991766 |
| size | 94,544 |
A simple Rust CLI to check and update Go (Golang) on Linux automatically. The program will:
https://go.dev/dl/?mode=jsongo version)/tmp/usr/local/go (via sudo/pkexec/su)go version)Rust edition: 2024
sudo β pkexec β su)sudo access to install to /usr/localgit clone https://github.com/christiandoxa/go-updater.git
cd go-updater
cargo build --release
./target/release/go-updater
Sample output:
Latest stable release on go.dev: go1.25.2
Local Go version: go1.24.8
Will update to go1.25.2 with: go1.25.2.linux-amd64.tar.gz
Downloaded: /tmp/go1.25.2.linux-amd64.tar.gz
SHA256 OK (...)
Running install: rm -rf /usr/local/go && tar -C /usr/local -xzf /tmp/go1.25.2.linux-amd64.tar.gz
Verification OK: go1.25.2
Done. Make sure PATH includes /usr/local/go/bin
go-updater/
βββ Cargo.toml
βββ .gitignore
βββ LICENSE
βββ README.md
βββ src/
β βββ lib.rs # core logic
β βββ main.rs # thin entrypoint (calls cli_main)
βββ tests/
βββ main_bin.rs # integration test for the binary
βββ real_impls.rs # RealHttp/RealSys/RealFs
βββ real_sys_run_root.rs # sudo/pkexec/su
βββ real_sys_run_root_missing.rs
βββ semver_eq_cmp.rs
βββ fallback_and_mismatch.rs
βββ map_arch.rs
βββ *.rs
If go is not found after installation:
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
All tests live under tests/ (integration + unit via the public API).
cargo test
Notes:
Tests do not require real network/root access: use the env overrides below when testing:
GO_UPDATER_JSON_INLINE β inject release JSON inlineGO_UPDATER_ASSUME_ROOT=1 β treat process as root on certain pathsGO_UPDATER_SUDO, GO_UPDATER_PKEXEC, GO_UPDATER_SU β point to fake binaries to test escalation fallbackcargo-llvm-cov)cargo install cargo-llvm-cov
cargo llvm-cov clean --workspace
cargo llvm-cov --workspace --all-features --html --open
# fail if line coverage < 100%
cargo llvm-cov --workspace --all-features --fail-under-lines 100
Tip: if you also want an LCOV file for external tooling:
cargo llvm-cov --workspace --all-features --lcov --output-path lcov.info
GO_UPDATER_JSON_INLINE β release JSON string to replace the HTTP fetchGO_UPDATER_JSON_URL β alternative URL (default: https://go.dev/dl/?mode=json)GO_UPDATER_ASSUME_ROOT=1 β force is_root() trueGO_UPDATER_SUDO, GO_UPDATER_PKEXEC, GO_UPDATER_SU β alternative paths for escalation binariesMIT Β© 2025 β Christian Doxa Hamasiah