Dev build - missing instructions

Timeline

Cyril Roelandt (Steap) opened (edited)

Hello,

This project seems super interesting, and I've managed to quickly try it. I wanted to try and write some code for it, but I am unfamiliar with go.

The "make" command complained about missing packages, so I ran:

$ go get github.com/spf13/cobra/doc
$ go get github.com/MichaelMure/git-bug/commands

Now, make fails with another error:

$ make
go generate
# command-line-arguments
doc/gen_markdown.go:20:28: cannot use commands.RootCmd (type *"github.com/MichaelMure/git-bug/vendor/github.com/spf13/cobra".Command) as type *"github.com/spf13/cobra".Command in argument to doc.GenMarkdownTree
git-bug.go:1: running "go": exit status 2
make: *** [Makefile:4: build] Error 1

I feel like README.md should have specific instructions for developers. Experienced Golang devs will not learn much, but it would be really helpful for people like me.

Michael Muré (MichaelMure) commented

Let start by figuring out what went wrong.

My guess it that you did a git clone instead of using go get to get the project. What happen when you do that is that you put the code outside of the GOPATH and the go compiler doesn't find anything anymore.

That or your go install is simply broken. What does go env return ?

Cyril Roelandt (Steap) commented

Thanks for your quick reply!

On 12/07/18 14:29, Michael Muré wrote:

My guess it that you did a git clone instead of using go get to get the project. What happen when you do that is that you put the code outside of the GOPATH and the go compiler doesn't find anything anymore.

Oh, I think I get it. When using Golang, you cannot actually choose where the git repository should be cloned? You have to do:

$ go get -u github.com/MichaelMure/git-bug

and then:

$ cd ~go/src/github.com/MichaelMure/git-bug

(which is basically cd $GOPATH/src/github.com/MichaelMure/git-bug, if I'm not mistaken).

If I do that, make works as expected.

This seems super counter-intuitive for a programmer who is not used to Golang. Maybe this should be made a bit clearer in README.md. Would you be interested in such a patch?

Michael Muré (MichaelMure) commented

That's a common pitfall for newcomers in go, but actually make sense once you get used to. Note that it wont be the case anymore with go 1.11 and the go modules, but we are not there yet.

Would you be interested in such a patch?

Sure, could you expand the Contribute section of the readme ? Maybe even make a new document in /doc and link to it if it becomes too long.

Michael Muré (MichaelMure) closed the bug

Michael Muré (MichaelMure) commented

Alright, now that it's done, anything you would like to work on ? Feel free to join the gitter lobby for a chat. French is fine too ;-)