Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mise fails to install nested Go tools #3806

Closed
zx8 opened this issue Dec 24, 2024 · 1 comment
Closed

Mise fails to install nested Go tools #3806

zx8 opened this issue Dec 24, 2024 · 1 comment
Labels

Comments

@zx8
Copy link

zx8 commented Dec 24, 2024

Describe the bug

Mise seems to sometimes(?) fail to install Go tools that are in subdirectory of the repository.

To Reproduce

$ mise install go:github.com/noperator/sol/cmd/sol@latest
go: invalid github.com import path "github.com/noperator"
go: invalid github.com import path "github.com"
mise WARN  No versions found for go:github.com/noperator/sol/cmd/sol

Expected behavior

It works, like go install.

mise doctor output

version: 2024.12.19 macos-arm64 (2024-12-23)
activated: yes
shims_on_path: no

build_info:
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS
  Built: Mon, 23 Dec 2024 19:02:19 +0000
  Rust Version: rustc 1.83.0 (90b35a623 2024-11-26) (Homebrew)
  Profile: release

shell:
  /opt/homebrew/bin/fish
  fish, version 3.7.1-2640-gf3dd4ee02

dirs:
  cache: ~/Library/Caches/mise
  config: ~/.config/mise
  data: ~/.local/share/mise
  shims: ~/.local/share/mise/shims
  state: ~/.local/state/mise

config_files:
  ~/.config/mise/config.toml

ignored_config_files: (none)

backends:
  aqua
  asdf
  cargo
  core
  dotnet
  gem
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins:
  terraform           https://github.com/asdf-community/asdf-hashicorp.git#f1602b6
  usage               https://github.com/jdx/mise-usage.git#fe3888a

toolset:
  go:golang.org/x/tools/[email protected]
  go:mvdan.cc/[email protected]

env_vars:
  MISE_SHELL=fish

settings:
  experimental         true  ~/.config/mise/config.toml
  pipx.uvx             true  ~/.config/mise/config.toml
  python.uv_venv_auto  true  ~/.config/mise/config.toml
  status.show_env      true  ~/.config/mise/config.toml
  status.show_tools    false ~/.config/mise/config.toml

No problems found
@zx8 zx8 added the bug label Dec 24, 2024
@eitamal
Copy link

eitamal commented Dec 26, 2024

That's an interesting find! But, I think it still completed successfully, no? The main issue seems to do with the lack of versions for sol. But I think this behaviour is actually expected due to how Go modules work with repositories that don't have version tags.

While go install github.com/noperator/sol/cmd/sol@latest works because Go can fall back to pseudo-versioning, the go list -m -versions command (which mise uses internally to discover available versions) doesn't return any results for repositories without explicit version tags.

You can verify this by running:

$ go list -m -versions -json github.com/noperator/sol/cmd/sol
{
        "Path": "github.com/noperator/sol/cmd/sol"
}

versus a repo with version tags:

$ go list -m -versions -json github.com/DarthSim/hivemind
{
        "Path": "github.com/DarthSim/hivemind",
        "Versions": [
                "v1.0.1",
                "v1.0.2",
                "v1.0.3",
                "v1.0.4",
                "v1.0.5",
                "v1.0.6",
                "v1.1.0"
        ]
}

So yeah, I think showing a warning is the correct thing to do here. The go: invalid github... is probably not great, though.

But the following works for me:

$ mise x go:github.com/noperator/sol/cmd/sol@latest -- sol --help
Usage of sol:
  -a    arguments
  -all
        all
  -b    binary commands: &&, ||, |, |&
  -c    command substitution: $(), ``
  -e    inspect env to resolve command types
  -f string
        file
  -j    jq
  -jqarr
        arrays
  -jqobj
        objects
  -jqop string
        operators (comma-separated)
  -l    clauses: case, for, if, while
  -o    one line
  -p    process substitution: <(), >()
  -r    redirect: >, >>, <, <>, <&, >&, >|, <<, <<-, <<<, &>, &>>
  -s    shell strings: xargs, parallel
  -v    verbose
  -w int
        max line width before breaking

NOTE: I'm not a maintainer; just giving my two cents 😅

Repository owner locked and limited conversation to collaborators Dec 26, 2024
@jdx jdx converted this issue into discussion #3822 Dec 26, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

2 participants