magefile / mage

a Make/rake-like dev tool using Go
https://magefile.org
Apache License 2.0
4.17k stars 256 forks source link

Bug: Can't install mage on Ubuntu 22.04 WSL under Windows 10 #510

Open brut0 opened 5 months ago

brut0 commented 5 months ago

Bug Description Installation failure message under mage installation

What did you do?

  1. Install go in my home directory
  2. Try to install mage

What did you expect to happen? I expected the install to work.

What actually happened? mage doesn't install

Environment

Additional context Erro message after go run bootstrap.go:

warning: GOPATH set to GOROOT (/home/user/go-1.22.4) has no effect
warning: GOPATH set to GOROOT (/home/user/go-1.22.4) has no effect
Running target: Install
exec: go "env" "GOBIN"
warning: GOPATH set to GOROOT (/home/user/go-1.22.4) has no effect
exec: git "rev-parse" "--short" "HEAD"
exec: git "describe" "--tags"
exec: go "build" "-o" "/home/user/go-1.22.4/mage" "-ldflags=-X \"github.com/magefile/mage/mage.timestamp=2024-06-13T14:45:35+03:00\" -X \"github.com/magefile/mage/mage.commitHash=2385abb\" -X \"github.com/magefile/mage/mage.gitTag=v1.15.0-5-g2385abb\"" "github.com/magefile/mage"

After second approach to instal via command go get -u -d github.com/magefile/mage:

go: go.mod file not found in current directory or any parent directory.
        'go get' is no longer supported outside a module.
        To build and install a command, use 'go install' with a version,
        like 'go install example.com/cmd@latest'
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.
notdanhan commented 4 months ago

This is a configuration issue! GOROOT should be where go is installed and GOPATH should be your go workspace :D

https://pkg.go.dev/cmd/go#hdr-Environment_variables