goleft icon indicating copy to clipboard operation
goleft copied to clipboard

Please include installation instructions

Open sjackman opened this issue 8 years ago • 9 comments

Thanks! A formula for Homebrew-science would be great.

sjackman avatar Dec 21 '16 23:12 sjackman

I added a section to the readme on installation, please have a look and let me know if you have any questions.

brentp avatar Dec 22 '16 00:12 brentp

go get doesn't seem to install any executables.

❯❯❯ GOPATH=~/.go go get -u github.com/brentp/goleft/...
package github.com/brentp/goleft/emdepth/mops: found packages mops (mops.go) and emdepth (mops_test.go) in /Users/sjackman/.go/src/github.com/brentp/goleft/emdepth/mops
❯❯❯ which goleft
goleft not found
❯❯❯ ls ~/.go/bin
ls: /Users/sjackman/.go/bin: No such file or directory

sjackman avatar Dec 22 '16 00:12 sjackman

go get should get you what you need for development. If you want to install, you can run go install from the directory where goleft resides. How can I clarify this?

brentp avatar Dec 22 '16 02:12 brentp

I can put the main into cmd/goleft/main.go and then go install should install the binary. I'll leave this open to track that change.

brentp avatar Dec 22 '16 15:12 brentp

Please see the updated readme and re-open this issue if you have any problems. Thanks for bringing this to my attention.

brentp avatar Dec 22 '16 17:12 brentp

I'd suggest add GOPATH and PATH to the installation instructions:

export GOPATH=~/.go
PATH="$GOPATH/bin:$PATH"
go get -u github.com/brentp/goleft/...
go install github.com/brentp/goleft/cmd/goleft
goleft --help
❯❯❯ GOPATH=~/.go go get -u github.com/brentp/goleft/...=
package github.com/brentp/goleft: no buildable Go source files in /Users/sjackman/.go/src/github.com/brentp/goleft

no buildable Go source files

Is that warning expected?

If you are using go, you can build from source with:

How do I build goleft from source? Is go install github.com/brentp/goleft/cmd/goleft installing a precompiled binary, or building from source?

Thanks for your help, Brent.

sjackman avatar Dec 22 '16 19:12 sjackman

I'm hesitant to add more than I already have since most users would and should just copy the provided binary to their $PATH unless they are familiar with the go ecosystem.

yes: go install github.com/brentp/goleft/cmd/goleft installs from source.

yes: the warning is expected since the root go directory contains no source code by design.

I'll re-open this as a placeholder with the intent of adding an INSTALL-dev.md for those wishing to build from source.

brentp avatar Dec 22 '16 19:12 brentp

for those wishing to build from source.

Perhaps I'm being pedantic, but go install github.com/brentp/goleft/cmd/goleft does install from source. How would the INSTALL-dev.md instructions differ from the README.md instructions?

I'm hesitant to add more than I already have

The README.md installation instructions should be sufficient to leave a working executable in the user's PATH. The current instructions yield:

❯❯❯ go get -u github.com/brentp/goleft/...
package github.com/brentp/goleft/...: cannot download, $GOPATH not set. For more details see: go help gopath

go help gopath yields 660 words. That badly needs a tl;dr summary, such as export GOPATH=~/.go. Someone familiar with the go ecosystem will know that they can skip this step.

since most users would and should just copy the provided binary to their $PATH

If so, then the installation instructions should include that step. It's currently not clear where the executable is installed, and it's not easy to copy an executable if you don't know where it is.

A suggestion:

export GOPATH=~/.go
go get -u github.com/brentp/goleft/...
go install github.com/brentp/goleft/cmd/goleft
~/.go/bin/goleft --help

Finally, copy the ~/.go/bin/goleft executable to a directory located in your $PATH, such as ~/bin.

sjackman avatar Dec 22 '16 19:12 sjackman

I see what you mean, I have made another commit to clarify the point about install vs from source.

Installing go should give you a working go installation where any thing installed by go install will be on your path. that's why I consider additional explanation as something to be relegated to a more detailed document outside the readme (which I want to keep brief).

I'm more sticky on all of this because I want to promote that the preferred way to use is to download the binary. That said, I want it to be used so I'll accept PR's that clarify anything I've overlooked.

brentp avatar Dec 22 '16 20:12 brentp