mage icon indicating copy to clipboard operation
mage copied to clipboard

Installation instructions don't work if run within a Go 1.11 module project directory

Open dmolesUC opened this issue 6 years ago • 2 comments

Steps to reproduce:

  • on a system without mage installed, clone a Go 1.11 module project that uses mage, e.g. https://github.com/dmolesUC3/cos

  • attempt to follow the installation instructions:

    go get -u -d github.com/magefile/mage
    cd $GOPATH/src/github.com/magefile/mage    # ← fails
    go run bootstrap.go
    

Expected:

  • mage is installed

Actual:

  • cd fails with:

    -bash: cd: /Users/david/Projects/Go/src/github.com/magefile/mage: No such file or directory
    
  • running find $GOPATH -type d -name mage shows only:

    /Users/david/Projects/Go/pkg/mod/cache/download/github.com/magefile/mage
    /Users/david/Projects/Go/pkg/mod/github.com/magefile/[email protected]/mage
    

Workaround:

  • change to a directory outside the project, e.g. $HOME, and rerun the installation instructions from there

Proposed change:

  • better installation instructions for users whose first exposure to mage is in the context of trying to build someone else's magefile-ized module project.

dmolesUC avatar Feb 08 '19 17:02 dmolesUC

Oops, yeah, the instructions were updated for modules in the README on github, but not on the website. Thanks for pointing this out.

Try this:

git clone https://github.com/magefile/mage
cd mage
go run bootstrap.go

natefinch avatar Feb 08 '19 19:02 natefinch

Using git clone seems bad to me. Wouldn't it be better to have mage installable by go install?

enumag avatar Jun 15 '23 08:06 enumag