diff --git a/docs/cli/generate.md b/docs/cli/generate.md index 7083ead915..a69c210fa5 100644 --- a/docs/cli/generate.md +++ b/docs/cli/generate.md @@ -1,7 +1,7 @@ # `mise generate` - **Usage**: `mise generate ` -- **Aliases**: `g` +- **Aliases**: `gen` - **Source code**: [`src/cli/generate.rs`](https://github.com/jdx/mise/blob/main/src/cli/generate.rs) [experimental] Generate files for various tools/services diff --git a/e2e-win/go.Tests.ps1 b/e2e-win/go.Tests.ps1 new file mode 100644 index 0000000000..1347f6cc1e --- /dev/null +++ b/e2e-win/go.Tests.ps1 @@ -0,0 +1,7 @@ + +Describe 'node' { + It 'executes go 1.23.3' { + mise x go@1.23.3 -- where go + mise x go@1.23.3 -- go version | Should -BeLike "go version go1.23.3 windows/*" + } +} diff --git a/mise.usage.kdl b/mise.usage.kdl index 86f29f3a73..d3880f9fbc 100644 --- a/mise.usage.kdl +++ b/mise.usage.kdl @@ -374,7 +374,8 @@ The "--" separates runtimes from the commands to pass along to the subprocess."# arg "[COMMAND]..." help="Command string to execute (same as --command)" var=true } cmd "generate" subcommand_required=true help="[experimental] Generate files for various tools/services" { - alias "g" + alias "gen" + alias "g" hide=true cmd "git-pre-commit" help="[experimental] Generate a git pre-commit hook" { alias "pre-commit" long_help r"[experimental] Generate a git pre-commit hook diff --git a/src/cli/generate/mod.rs b/src/cli/generate/mod.rs index 89bcd53ec1..8262a372a9 100644 --- a/src/cli/generate/mod.rs +++ b/src/cli/generate/mod.rs @@ -6,7 +6,7 @@ mod task_docs; /// [experimental] Generate files for various tools/services #[derive(Debug, clap::Args)] -#[clap(visible_alias = "g")] +#[clap(visible_alias = "gen", alias = "g")] pub struct Generate { #[clap(subcommand)] command: Commands, diff --git a/src/plugins/core/go.rs b/src/plugins/core/go.rs index 87b766adfc..a413736170 100644 --- a/src/plugins/core/go.rs +++ b/src/plugins/core/go.rs @@ -32,7 +32,7 @@ impl GoPlugin { // Represents go binary path fn go_bin(&self, tv: &ToolVersion) -> PathBuf { - tv.install_path().join("bin/go") + tv.install_path().join("bin").join("go") } // Represents GOPATH environment variable @@ -93,7 +93,7 @@ impl GoPlugin { fn download(&self, tv: &ToolVersion, pr: &dyn SingleReport) -> eyre::Result { let settings = Settings::get(); - let filename = format!("go{}.{}-{}.tar.gz", tv.version, platform(), arch()); + let filename = format!("go{}.{}-{}.{}", tv.version, platform(), arch(), ext()); let tarball_url = format!("{}/{}", &settings.go_download_mirror, &filename); let tarball_path = tv.download_path().join(&filename); @@ -126,7 +126,11 @@ impl GoPlugin { .to_string_lossy(); pr.set_message(format!("installing {}", tarball)); let tmp_extract_path = tempdir_in(tv.install_path().parent().unwrap())?; - file::untar(tarball_path, tmp_extract_path.path())?; + if cfg!(windows) { + file::unzip(tarball_path, tmp_extract_path.path())?; + } else { + file::untar(tarball_path, tmp_extract_path.path())?; + } file::remove_all(tv.install_path())?; file::rename(tmp_extract_path.path().join("go"), tv.install_path())?; Ok(()) @@ -239,3 +243,11 @@ fn arch() -> &'static str { &ARCH } } + +fn ext() -> &'static str { + if cfg!(windows) { + "zip" + } else { + "tar.gz" + } +} diff --git a/src/plugins/core/mod.rs b/src/plugins/core/mod.rs index 0b5b94e5f5..8c695c1f61 100644 --- a/src/plugins/core/mod.rs +++ b/src/plugins/core/mod.rs @@ -15,14 +15,10 @@ use crate::plugins::core::bun::BunPlugin; use crate::plugins::core::deno::DenoPlugin; #[cfg(unix)] use crate::plugins::core::erlang::ErlangPlugin; -#[cfg(unix)] use crate::plugins::core::go::GoPlugin; use crate::plugins::core::java::JavaPlugin; use crate::plugins::core::node::NodePlugin; -#[cfg(unix)] use crate::plugins::core::ruby::RubyPlugin; -#[cfg(windows)] -use crate::plugins::core::ruby_windows::RubyPlugin; #[cfg(unix)] use crate::plugins::core::zig::ZigPlugin; use crate::plugins::{Plugin, PluginList, PluginType}; @@ -35,15 +31,12 @@ mod bun; mod deno; #[cfg(unix)] mod erlang; -#[cfg(unix)] mod go; mod java; mod node; mod python; -#[cfg(unix)] +#[cfg_attr(windows, path = "ruby_windows.rs")] mod ruby; -#[cfg(windows)] -mod ruby_windows; #[cfg(unix)] mod zig; @@ -64,7 +57,7 @@ pub static CORE_PLUGINS: Lazy = Lazy::new(|| { // Arc::new(BunPlugin::new()), Arc::new(DenoPlugin::new()), // Arc::new(ErlangPlugin::new()), - // Arc::new(GoPlugin::new()), + Arc::new(GoPlugin::new()), Arc::new(JavaPlugin::new()), Arc::new(NodePlugin::new()), Arc::new(PythonPlugin::new()), diff --git a/src/plugins/core/python.rs b/src/plugins/core/python.rs index 75d1c50098..79b1d8f49b 100644 --- a/src/plugins/core/python.rs +++ b/src/plugins/core/python.rs @@ -462,7 +462,7 @@ fn python_arch() -> &'static str { fn ensure_not_windows() -> eyre::Result<()> { if cfg!(windows) { - bail!("python can not currently be compiled on windows"); + bail!("python can not currently be compiled on windows with core:python, use vfox:python instead"); } Ok(()) }