Cannot build open-source project
Asked 7 years, 11 months ago Modified 7 years, 11 months ago Viewed 463 times
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.
1
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.
1. I've installed go using homebrew :
$ brew install go
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
libebml
==> Downloading [Link]
[Link]
Already downloaded: /Users/gmile/Library/Caches/Homebrew/go-
[Link]
==> Pouring [Link]
==> Caveats
A valid GOPATH is required to use the `go get` command.
If $GOPATH is not specified, $HOME/go will be used by default:
[Link]
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
$
2. Then I cloned the repo:
$ hub clone lucapette/fakedata
3. I ran make setup (per instruction), which at first did not complete successfully:
$ make setup
go get -u [Link]/alecthomas/gometalinter
gometalinter --install
make: gometalinter: No such file or directory
make: *** [setup] Error 1
$
I figured that is because gometalinter is nowhere in my $PATH , so have added it (I'm
using fish-shell):
$ set fish_user_paths /Users/gmile/go/bin
4. running make setup seem to have succeeded now. This is the output:
$ make setup
go get -u [Link]/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
$
5. Running make build fails:
$ make build
go build
[Link]:2: cannot find package"[Link]/lucapette/fakedata/pkg/fakedata" in
any of:
/usr/local/Cellar/go/1.8.3/libexec/src/[Link]/lucapette/fakedata/pkg/fakedata
(from $GOROOT)
/Users/gmile/go/src/[Link]/lucapette/fakedata/pkg/fakedata (from
$GOPATH)
[Link]:2: cannot find package "[Link]/spf13/pflag" in any of:
/usr/local/Cellar/go/1.8.3/libexec/src/[Link]/spf13/pflag (from
$GOROOT)
/Users/gmile/go/src/[Link]/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.
macos go build
Share Improve this question Follow asked Aug 19, 2017 at 12:49
oldhomemovie
15.2k 16 68 104
2 Answers Sorted by: Highest score (default)
Your path when cloning the source must be on the golang PATH like :
/home/gujarat/golang/src/[Link]/lucapette/fakedata
5
as you can see my Path to golang path is : /home/gujarat/golang/ . You can also print your
golang path in your terminal by entering : $GOPATH .
And the git clone should be in the following the exact as above path :
src/[Link]/lucapette/ .
cd $GOPATH/src/[Link]/
mkdir lucaptte
cd lucapette
git clone [Link]
When you are running the make command which trigger go build this command will look
the $GOPATH and your $GOROOT folder.
Share Improve this answer Follow answered Aug 19, 2017 at 13:26
Gujarat Santana
10.6k 17 55 76
Your go source should in your gopath - here it is Users/gmile/src. Use go get to fetch the pkg
you want to work on instead and it should work.
0
Share Improve this answer Follow answered Aug 19, 2017 at 13:10
Kenny Grant
9,673 2 34 47
Start asking to get answers
Find the answer to your question by asking.
Ask question
Explore related questions
macos go build
See similar questions with these tags.