From 09673297dbe59ba768b6a16e9c0cf4921096dcd3 Mon Sep 17 00:00:00 2001 From: Akeshihiro Date: Wed, 24 Feb 2021 11:17:03 +0100 Subject: [PATCH] Drop the Go step (#660) * Drop the Go step With the release of Go 1.16 the behavior of `go get` has been changed. In previous Go versions `go get` was used not only to add module dependencies but also to install Go tools. As of Go 1.16 `go get` can only add and upgrade module dependencies. To install Go tools now the `go install` command has to be used. Further on Go 1.16 enabled the GOMODULE mode by default and will drop the GOPATH mode completly in Go 1.17. So the package definition `all` like in `go get -u all` does not work anymore if the PWD is outside of a Go module project. Because of this `go list all` also does not work for the same reason. That being said it seems that currently there is no way to get a list of all installed Go tools or packages at the GOPATH level. So the only possible solution to determine the installed Go tools and also to update them would be by inspecting the `go env GOBIN` directory as well as the `go env GOMODCACHE` sub-directories and to filter the results according to their possible name-to-package boundaries. As this approach seems to be very ugly and also not to be very safe or stable and Go currently does not support any kind of automated upgrades of installed Go tools it is best to drop the Go step for now until Go implements some kind of Go tool upgrade feature. Fixes #659 * Remove Go from Step enum --- src/config.rs | 1 - src/executor.rs | 1 + src/main.rs | 1 - src/steps/generic.rs | 13 ------------- 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/config.rs b/src/config.rs index d009a798..4bc15299 100644 --- a/src/config.rs +++ b/src/config.rs @@ -82,7 +82,6 @@ pub enum Step { Gcloud, Gem, GitRepos, - Go, HomeManager, Jetpack, Krew, diff --git a/src/executor.rs b/src/executor.rs index 7e14533a..1c601657 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -101,6 +101,7 @@ impl Executor { self } + #[allow(dead_code)] /// See `std::process::Command::remove_env` pub fn env_remove(&mut self, key: K) -> &mut Executor where diff --git a/src/main.rs b/src/main.rs index b5fb9918..f8a48b52 100644 --- a/src/main.rs +++ b/src/main.rs @@ -286,7 +286,6 @@ fn run() -> Result<()> { runner.execute(Step::Choosenim, "choosenim", || generic::run_choosenim(&ctx))?; runner.execute(Step::Cargo, "cargo", || generic::run_cargo_update(run_type))?; 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(run_type))?; runner.execute(Step::Opam, "opam", || generic::run_opam_update(run_type))?; runner.execute(Step::Vcpkg, "vcpkg", || generic::run_vcpkg_update(run_type))?; diff --git a/src/steps/generic.rs b/src/steps/generic.rs index 850c62ca..bdcc9f54 100644 --- a/src/steps/generic.rs +++ b/src/steps/generic.rs @@ -42,19 +42,6 @@ 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()?; - - print_separator("Go"); - run_type - .execute(&go) - .args(&["get", "-u", "all"]) - .current_dir(gopath) - .env_remove("GO111MODULE") - .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()?;