Closed stuarthicks closed 3 weeks ago
It seems that i am not able to reproduce this via mise use -g go:github.com/oligot/go-mod-upgrade@latest
.
As i recall such entries are not cached but it might not hurt trying to clear the cache via mise cache clear
.
What you describe could stem from old behaviour. Backends (e.g. Go modules) are renamed when downloaded to ~/.local/share/mise/installs
. Slashes and other special characters are replaced with dashes, so github.com/oligot/go-mod-upgrade
becomes go-github-com-oligot-go-mod-upgrade
. With this renaming mise
cannot derive the plugin name from the generated directory name especially for module names with dashes. For this reason a meta file has been introduced. When listing backends mise
should read from this meta file or falls back to old behaviour trying to derive from the directory name which might lead to the behaviour you see.
Can you check if that meta file exists and has expected content?
cat ~/.local/share/mise/installs/go-github-com-oligot-go-mod-upgrade/.mise.backend.json
{"id":"go:github.com/oligot/go-mod-upgrade","name":"github.com/oligot/go-mod-upgrade","backend_type":"go"}
Removing and re-installing the tool should fix the issue.
Hmm. I don't see a .mise.backend.json
:
❯ cat ~/.local/share/mise/installs/go-github-com-oligot-go-mod-upgrade/.mise.backend.json
cat: /Users/stuart/.local/share/mise/installs/go-github-com-oligot-go-mod-upgrade/.mise.backend.json: No such file or directory
zsh: exit 1 cat
However, I do see two directories in the install dir for that tool, and both contain a .mise.forge.json
file:
❯ cat ~/.local/share/mise/installs/go-github-com-oligot-go-mod-upgrade/.mise.forge.json
{"id":"go:github.com/oligot/go-mod-upgrade","name":"github.com/oligot/go-mod-upgrade","forge_type":"go"}
❯ cat ~/.local/share/mise/installs/go-github.com-oligot-go-mod-upgrade/.mise.forge.json
{"id":"go:github.com/oligot/go-mod-upgrade","name":"github.com/oligot/go-mod-upgrade","forge_type":"go"}
Uninstalling and then reinstalling the tool in this state does not seem to fix the issue:
❯ mise ls |& grep upgrade
go:github.com/oligot/go/mod/upgrade 0.10.0
go:github/com/oligot/go/mod/upgrade 0.10.0
❯ mise uninstall go:github.com/oligot/go-mod-upgrade
mise go:github.com/oligot/go-mod-upgrade@0.10.0 ✓ uninstalled
❯ mise ls |& grep upgrade
zsh: done mise ls 2>&1 |
zsh: exit 1 grep upgrade
❯ mise install go:github.com/oligot/go-mod-upgrade@0.10.0
mise go:github.com/oligot/go-mod-upgrade@0.10.0 ✓ installed
❯ mise ls |& grep upgrade
go:github.com/oligot/go-mod-upgrade 0.10.0
go:github.com/oligot/go/mod/upgrade 0.10.0
I've also attempted mise cache clear
(with the tool uninstalled as well), and that also did not fix the issue, the duplicate tool entry reappears as soon as the tool is reinstalled (the forge json files and those two install dirs continue to exist).
From your description, it certainly sounds plausible that go-mod-upgrade was installed initially with a previous version of mise with a different install directory name, and at some point the new install directory has been created.
I've managed to resolve this by uninstalling the tool, manually deleting all the install directories for it, and then reinstalling it, although it would be helpful I guess if mise were able to identify/clear that invalid state itself (either clear it with mise cache clear
or report it in mise doctor
).
As a strategy for identifying this issue, seeing if there are multiple forge json files that contain the same metadata seems to work reliably. eg in bash:
❯ find ~/.local/share/mise/installs -maxdepth 2 -type f -name .mise.forge.json | while read -r forge; do jq -r '[.forge_type, .id, .name] | @tsv' "${forge}"; done | sort | uniq -c | sort -nr | grep -v '^\s*1' | column -t
2 go go:github.com/oligot/go-mod-upgrade github.com/oligot/go-mod-upgrade
2 go go:github.com/maruel/panicparse/v2/cmd/pp github.com/maruel/panicparse/v2/cmd/pp
The go-mod-upgrade tool (and the panicparse tool) were both in this state on my machine (before I fixed it by clearing out these dirs myself):
❯ ls -1 .local/share/mise/installs | grep -E '(upgrade|panicparse)'
go-github-com-maruel-panicparse-v2-cmd-pp
go-github-com-oligot-go-mod-upgrade
go-github.com-maruel-panicparse-v2-cmd-pp
go-github.com-oligot-go-mod-upgrade
Sorry for the wall of text. I understand if you decide this isn't a bug since it only occurs with state from old mise versions. If nothing else, perhaps this issue will show in in search results for anyone else who finds this same thing happening with their mise setup.
Thanks for your help!
It seems some refactoring changes came in meanwhile with changes in the directory and meta data file naming, leading to this issue. So cleaning out these directories manually, is as of now the best way to resolve this. Given backends are still experimental i don't think its worth the effort to deal with potential upgrade paths and cleanups in the code at this point.
Totally reasonable. I'll close this. Thanks again!
Describe the bug
There appears to be some sort of plugin/toolset naming issue when using the Go backend. It impacts some Go tools but not others (I'm not sure what exactly the trigger is), and results in some mise commands showing multiple toolsets, with some entries being invalid.
To Reproduce
Then look at
mise ls
(I've removed lines from other installed tools to keep the output tidier, but the full list of tools is in themise doctor
output below, if relevant):The go-mod-upgrade tool has been added twice, and
mise prune
will incorrectly attempt to remove the "inactive" version (which then removes both entries).Expected behavior I expected only a single entry to be installed, matching this line:
mise doctor
outputAdditional context
No obvious cause in the
--debug
or--trace
output. The installed tool works correctly, so this is purely a presentation issue. For what it's worth, while I've raised this issue from macOS, the same behaviour reproduces on my other machine, which is Fedora Linux (via Windows Subsystem for Linux).