I'd like to contribute to an OSS project built with go, but I'm having hard time compiling it. It looks as if I'm missing something obvious.
I think the problem is related to how go is installed on my computer, and not to the project itself, thus I'm posting it here on StackOverflow, instead of project's "Issues" section.
Below is what I'm doing.
I've installed
gousinghomebrew:$ brew install go Updating Homebrew... ==> Auto-updated Homebrew! Updated 1 tap (homebrew/core). ==> Updated Formulae libebml ==> Downloading https://homebrew.bintray.com/bottles/go-1.8.3.sierra.bottle.tar.gz Already downloaded: /Users/gmile/Library/Caches/Homebrew/go-1.8.3.sierra.bottle.tar.gz ==> Pouring go-1.8.3.sierra.bottle.tar.gz ==> Caveats A valid GOPATH is required to use the `go get` command. If $GOPATH is not specified, $HOME/go will be used by default: https://golang.org/doc/code.html#GOPATH You may wish to add the GOROOT-based install location to your PATH: export PATH=$PATH:/usr/local/opt/go/libexec/bin ==> Summary 🍺 /usr/local/Cellar/go/1.8.3: 7,035 files, 282.0MB $Then I cloned the repo:
$ hub clone lucapette/fakedataI ran
make setup(per instruction), which at first did not complete successfully:$ make setup go get -u github.com/alecthomas/gometalinter gometalinter --install make: gometalinter: No such file or directory make: *** [setup] Error 1 $I figured that is because
gometalinteris nowhere in my$PATH, so have added it (I'm using fish-shell):$ set fish_user_paths /Users/gmile/go/binrunning
make setupseem to have succeeded now. This is the output:$ make setup go get -u github.com/alecthomas/gometalinter gometalinter --install Installing: aligncheck deadcode dupl errcheck gas goconst gocyclo goimports golint gosimple gotype ineffassign interfacer lll megacheck misspell safesql staticcheck structcheck unconvert unparam unused varcheck $Running
make buildfails:$ make build go build main.go:11:2: cannot find package"github.com/lucapette/fakedata/pkg/fakedata" in any of: /usr/local/Cellar/go/1.8.3/libexec/src/github.com/lucapette/fakedata/pkg/fakedata (from $GOROOT) /Users/gmile/go/src/github.com/lucapette/fakedata/pkg/fakedata (from $GOPATH) main.go:12:2: cannot find package "github.com/spf13/pflag" in any of: /usr/local/Cellar/go/1.8.3/libexec/src/github.com/spf13/pflag (from $GOROOT) /Users/gmile/go/src/github.com/spf13/pflag (from $GOPATH) make: *** [build] Error 1 $
So either Contributing guideline is incomplete, or I'm missing something obvious about installing and managing go packages.