jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
10.18k stars 293 forks source link

Error installing go (golang) #2665

Open Heus-Sueh opened 1 month ago

Heus-Sueh commented 1 month ago

Describe the bug

go: GOPATH entry is relative; must be absolute path: "$HOME/Codelearning/go". this user "codelearning" is not mine

🞈 mise use -g go
go: GOPATH entry is relative; must be absolute path: "$HOME/Codelearning/go".
For more details see: 'go help gopath'
mise ~/.local/share/mise/installs/go/1.23.1/bin/go failed
go: GOPATH entry is relative; must be absolute path: "$HOME/Codelearning/go".
For more details see: 'go help gopath'
Error:
   0: ~/.local/share/mise/installs/go/1.23.1/bin/go exited with non-zero status: exit code 2

Location:
   src/cmd.rs:380

Version:
   2024.6.6 linux-x64 (409d6e4 2024-06-20)

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

To Reproduce mise use -g go in an immutable/atomic distro like Fedora Atomic

Expected behavior go be installed

mise doctor output

version: 2024.9.9 linux-x64 (61cc34b 2024-09-25)
activated: yes
shims_on_path: yes

build_info: 
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Wed, 25 Sep 2024 18:27:17 +0000
  Rust Version: rustc 1.81.0 (eeb90cda1 2024-09-04)
  Profile: release

shell: 
  /bin/zsh
  zsh 5.9 (x86_64-redhat-linux-gnu)

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

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

backends: 
  cargo
  core
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins: 
  watchexec  https://github.com/nyrst/asdf-watchexec.git#b667a08

toolset: 
  java@17.0.2      
  python@3.12.6    
  watchexec@2.1.2  

env_vars: 
  MISE_SHELL=zsh

settings: 
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf = true
  asdf_compat = false
  cache_prune_age = "30d"
  cargo_binstall = true
  ci = false
  color = true
  debug = false
  disable_default_shorthands = false
  disable_hints = []
  disable_tools = []
  experimental = true
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  http_timeout = 30
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  libgit2 = true
  log_level = "info"
  not_found_auto_install = true
  paranoid = false
  pipx_uvx = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "~/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  python_venv_auto_create = false
  quiet = false
  raw = false
  trace = false
  trusted_config_paths = []
  use_versions_host = true
  verbose = false
  vfox = false
  yes = false

  [node]

  [ruby]
  default_packages_file = "~/.default-gems"
  ruby_build_repo = "https://github.com/rbenv/ruby-build.git"
  ruby_install = false
  ruby_install_repo = "https://github.com/postmodern/ruby-install.git"

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No warnings found
No problems found

Additional context I was trying to install go just to play around and I couldn't Trace-log.txt

roele commented 1 month ago

Bom dia Metheus!

Just tried with a fedora distro which did no show any issues. Your mise version used seems a bit dated but that should not be the problem. I assume an existing environment variable might interfere.

$ docker run -it --rm fedora /bin/sh
$ yum install -y yum-utils
$ yum-config-manager --add-repo https://mise.jdx.dev/rpm/mise.repo
$ yum install -y mise
$ mise use -g go
$ mise x -- go version
go version go1.23.1 linux/arm64

Can you post your env output?

Heus-Sueh commented 1 month ago

Just tried with a fedora distro which did no show any issues.

I believe this bug affects the atomic version of Fedora, if mise is trying to install on /usr it will not be able to install, because this directory is read-only for security

https://fedoraproject.org/atomic-desktops/

Can you post your env output?

env:

🞈 mise env
export JAVA_HOME=/var/home/heus/.local/share/mise/installs/java/17.0.2
export PATH='/var/home/heus/.local/share/mise/installs/java/17/bin:/var/home/heus/.local/share/mise/installs/python/3.12/bin:/var/home/heus/.local/share/mise/installs/watchexec/latest/bin:/var/home/heus/.local/share/mise/shims:/usr/lib64/ccache:/var/home/heus/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/var/home/heus/.local/bin:/var/home/heus/.cargo/bin:/var/home/heus/.scripts/:/var/lib/flatpak/exports/bin:/var/home/heus/.local/share/flatpak/exports/bin:/usr/local/go/bin'
roele commented 1 month ago

I believe this bug affects the atomic version of Fedora, if mise is trying to install on /usr it will not be able to install, because this directory is read-only for security

I guess in this case you need to set MISE_DATA_DIR (and maybe others) to a directory that is writable.

Heus-Sueh commented 1 month ago

I believe this bug affects the atomic version of Fedora, if mise is trying to install on /usr it will not be able to install, because this directory is read-only for security

I guess in this case you need to set MISE_DATA_DIR (and maybe others) to a directory that is writable.

image

but by default it is already configured for the home which is not a problem, the problem would be being set in a system directory

roele commented 1 month ago

I would be interested in your env output (not mise env). AFAIK mise does not set GOPATH so its probably set by something else.

Heus-Sueh commented 1 month ago

I would be interested in your env output (not mise env). AFAIK mise does not set GOPATH so its probably set by something else.

I managed to solve it by setting these paths manually in bashrc

export GOPATH=$HOME/.go
export GOMODCACHE=$HOME/.go/pkg/mod

but I have no idea where this "codelearning" user came from, I've already checked in /etc/environment, /etc/profile, bashrc or zshrc