sapcc/mosquitto-exporter

troubles building

Closed this issue · 3 comments

I am not very familiar with go, so I'm not sure how to debug this.

I git cloned your repository, and then tried to run make build. I get these errors:

achin@bigbox:/nas/achin/devel/mosquitto-exporter$ make build
go build -o bin/mosquitto_exporter -ldflags="-s -w -X main.Version=0.5.0 -X main.GITCOMMIT=`git rev-parse --short HEAD`" github.com/sapcc/mosquitto-exporter
can't load package: package github.com/sapcc/mosquitto-exporter: cannot find package "github.com/sapcc/mosquitto-exporter" in any of:
        /nas/achin/devel/go/src/github.com/sapcc/mosquitto-exporter (from $GOROOT)
        /nas/achin/devel/gopath/src/github.com/sapcc/mosquitto-exporter (from $GOPATH)
Makefile:19: recipe for target 'build' failed
make: *** [build] Error 1

I'm using this version of go:

go version go1.12.4 linux/amd64

Any suggestions?

No, I had not set GOPATH. That fixed the build problem. Thanks

This does not work for me. If I set GOPATH to the root project directory, it looks in src, not in vendor. If I set GOPATH to the vendor directory, it looks in vendor/src. What am I doing wrong?

Edit: Ok, I mixed things up a bit. I only got it working now by using the folder structure src/github.com/sapcc/mosquitto-exporter/<project>. Is this really necessary? Can't I just put this project source in any directory? How can I avoid this?