Re-add the Go step via go-global-update (#823)

* Re-add the Go step via go-global-update

go-global-update (https://github.com/Gelio/go-global-update) is a small
tool to update all executables installed in a user's GOBIN, effectively
providing a `go get -u all` replacement for Go 1.16+.

Since it appears that Go will not be receiving a built-in way to do this
in the near future, this could be a good option in the meantime.

* Skip silently if go-global-update is not present
This commit is contained in:
Quinton Cloutier
2022-01-16 16:24:57 -04:00
committed by GitHub
parent 54741ff899
commit 51b35b374c
3 changed files with 15 additions and 0 deletions

View File

@@ -88,6 +88,7 @@ pub enum Step {
Gcloud,
Gem,
GitRepos,
Go,
Haxelib,
GnomeShellExtensions,
HomeManager,

View File

@@ -291,6 +291,7 @@ fn run() -> Result<()> {
runner.execute(Step::Choosenim, "choosenim", || generic::run_choosenim(&ctx))?;
runner.execute(Step::Cargo, "cargo", || generic::run_cargo_update(&ctx))?;
runner.execute(Step::Flutter, "Flutter", || generic::run_flutter_upgrade(run_type))?;
runner.execute(Step::Go, "Go", || generic::run_go(run_type))?;
runner.execute(Step::Emacs, "Emacs", || emacs.upgrade(&ctx))?;
runner.execute(Step::Opam, "opam", || generic::run_opam_update(run_type))?;
runner.execute(Step::Vcpkg, "vcpkg", || generic::run_vcpkg_update(run_type))?;

View File

@@ -63,6 +63,19 @@ pub fn run_flutter_upgrade(run_type: RunType) -> Result<()> {
run_type.execute(&flutter).arg("upgrade").check_run()
}
pub fn run_go(run_type: RunType) -> Result<()> {
let go = utils::require("go")?;
let gopath = run_type.execute(&go).args(&["env", "GOPATH"]).check_output()?;
let go_global_update = utils::require("go-global-update")
.unwrap_or_else(|_| PathBuf::from(gopath).join("bin/go-global-update"))
.require()?;
print_separator("Go");
run_type.execute(&go_global_update).check_run()
}
pub fn run_gem(base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {
let gem = utils::require("gem")?;
base_dirs.home_dir().join(".gem").require()?;