From e5f7c74c84087717eb1e7b0d6a7e7a8ce1d41cc0 Mon Sep 17 00:00:00 2001 From: Andrei Pavel Date: Wed, 20 Nov 2019 14:41:05 +0200 Subject: [PATCH] =?UTF-8?q?[=F0=9F=93=A6=20NEW]=20go=20get=20-u=20all=20(#?= =?UTF-8?q?262)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config.rs | 1 + src/main.rs | 9 +++++++++ src/steps/generic.rs | 13 ++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index f59e88f7..aea9866b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -34,6 +34,7 @@ pub enum Step { Rustup, Cargo, Flutter, + Go, Shell, Opam, Vcpkg, diff --git a/src/main.rs b/src/main.rs index b008b926..5803fc75 100644 --- a/src/main.rs +++ b/src/main.rs @@ -355,6 +355,15 @@ fn run() -> Result<(), Error> { )?; } + if config.should_run(Step::Go) { + execute( + &mut report, + "Go", + || generic::run_go(&base_dirs, run_type), + config.no_retry(), + )?; + } + if config.should_run(Step::Emacs) { execute(&mut report, "Emacs", || emacs.upgrade(run_type), config.no_retry())?; } diff --git a/src/steps/generic.rs b/src/steps/generic.rs index 2abb827d..06cb9c2f 100644 --- a/src/steps/generic.rs +++ b/src/steps/generic.rs @@ -4,6 +4,7 @@ use crate::terminal::{print_separator, shell}; use crate::utils::{self, PathExt}; use directories::BaseDirs; use failure::ResultExt; +use std::env; use std::path::PathBuf; use std::process::Command; @@ -20,11 +21,21 @@ pub fn run_cargo_update(run_type: RunType) -> Result<(), Error> { pub fn run_flutter_upgrade(run_type: RunType) -> Result<(), Error> { let flutter = utils::require("flutter")?; - print_separator("Flutter"); + print_separator("Flutter"); run_type.execute(&flutter).arg("upgrade").check_run() } +pub fn run_go(base_dirs: &BaseDirs, run_type: RunType) -> Result<(), Error> { + let go = utils::require("go")?; + env::var("GOPATH") + .unwrap_or_else(|_| base_dirs.home_dir().join("go").to_str().unwrap().to_string()) + .require()?; + + print_separator("Go"); + run_type.execute(&go).arg("get").arg("-u").arg("all").check_run() +} + pub fn run_gem(base_dirs: &BaseDirs, run_type: RunType) -> Result<(), Error> { let gem = utils::require("gem")?; base_dirs.home_dir().join(".gem").require()?;