Open vpavlin opened 9 years ago
You are correct about the makefile trying to invoke test when there's nothing to build for the first time. That should definitely not be there. I will fix that. Not quite sure why the CLI package is not installing correctly. What steps did you take to install?
As for the last point, Sirupsen's logrus is also a dependency for installing -- which I forgot to include in the readme. I will add that.
No steps taken:-) Just
git clone https://github.com/alecbenson/nulecule-go/
cd nulecule-go/atomicapp
make
As described above, when is do go get
for nulecule-go/cli, I get logrus pulled in as well..
When you are cloning the repo, are you cloning it to a directory within your $GOPATH
? If not, that might explain why you need to do a go get
in order to be able to use the program.
I might be confused, but I think I have it there:
[root@localhost atomicapp]# export GOPATH=/vagrant_data/nulecule-go/
[root@localhost atomicapp]# make clean
rm atomicgo
[root@localhost atomicapp]# make
go build -o atomicgo .
main.go:4:2: cannot find package "github.com/alecbenson/nulecule-go/atomicapp/cli" in any of:
/usr/lib/golang/src/github.com/alecbenson/nulecule-go/atomicapp/cli (from $GOROOT)
/vagrant_data/nulecule-go/src/github.com/alecbenson/nulecule-go/atomicapp/cli (from $GOPATH)
make: *** [all] Error 1
[root@localhost atomicapp]# pwd
/vagrant_data/nulecule-go/atomicapp
Okay, I think I see what the issue is. Your $GOPATH
should point to where Golang is installed on your machine. So for example, my $GOPATH
points to /home/abenson/go/bin
All of your Go projects should reside within the go
directory (Go development is kind of odd in this way :) ). So when you are trying to build with make
, Go is looking for the different Go packages (like CLI, for example), in a folder in /usr/lib/golang/src/github.com/alecbenson/nulecule-go/atomicapp/cli
. When you do a go get github.com/alecbenson/nulecule-go/atomicapp/cli
, things start working because go installs the project into the folder that it expects to find it in (which is /usr/lib/golang/src/github.com/alecbenson/nulecule-go/atomicapp/cli
).
Here's how I would fix the problem you are having:
$GOPATH
to /usr/lib/golang/bin
GOPATH
to your $PATH
(export PATH=$PATH:$GOPATH
)/usr/lib/golang/src/github.com/alecbenson/
It's convenient to add these to your bashrc so that you don't have to adjust your environment variables each time.
That should get things up and running. Fingers are crossed, let me know if you bump into any problems.
If I call
make
cmd it fails with messagei.e. target
all
shouldn't depend on targettest
as there is nothing to test when you try to build for the first timeSecond thing is that when I remove the
test
dependency from Makedfile, I get this:Doing
go get github.com/alecbenson/nulecule-go/atomicapp/cli
fixes it, but it feels weird to have to go get the package that is part of the application first..logrus and yaml are pulled just fine.Last thing is that even when the build passes (after doing
go get
andgo build
),make test
still fails with