Using "promu" with gb projects?
Closed this issue · 9 comments
Hello, fairly new Golang programmer and have been using gb
for a project of mine. I am trying to use promu for building release binaries for my project. However, by default it assumes the project to be in $GOPATH
which my project is not (since I am using gb
and this is one of the reasons I am using it).
Hence promu build
basically fails to find my project. Has anyone tried using it with gb
projects?
Thanks, just to see if I can build without using gb
, I tried:
$ env GOPATH=$(gb env GB_SRC_PATH) go build src/gitbackup/main.go src/gitbackup/client.go src/gitbackup/backup.go src/gitbackup/repositories.go
But, it doesn't find the packages in vendor
it seems.
promu is using go build. So I thought it would make it easier for me to first try building directly.
Sure.
env GOPATH=$(gb env GB_SRC_PATH) go build src/gitbackup/main.go src/gitbackup/client.go src/gitbackup/backup.go src/gitbackup/repositories.go
src/gitbackup/client.go:4:2: cannot find package "github.com/google/go-github/github" in any of:
/usr/local/Cellar/go/1.8/libexec/src/github.com/google/go-github/github (from $GOROOT)
/Users/asaha/work/github.com/amitsaha/gitbackup/src/src/github.com/google/go-github/github (from $GOPATH)
/Users/asaha/work/github.com/amitsaha/gitbackup/vendor/src/src/github.com/google/go-github/github
src/gitbackup/backup.go:4:2: cannot find package "github.com/mitchellh/go-homedir" in any of:
/usr/local/Cellar/go/1.8/libexec/src/github.com/mitchellh/go-homedir (from $GOROOT)
/Users/asaha/work/github.com/amitsaha/gitbackup/src/src/github.com/mitchellh/go-homedir (from $GOPATH)
/Users/asaha/work/github.com/amitsaha/gitbackup/vendor/src/src/github.com/mitchellh/go-homedir
src/gitbackup/backup.go:5:2: cannot find package "github.com/spf13/afero" in any of:
/usr/local/Cellar/go/1.8/libexec/src/github.com/spf13/afero (from $GOROOT)
/Users/asaha/work/github.com/amitsaha/gitbackup/src/src/github.com/spf13/afero (from $GOPATH)
/Users/asaha/work/github.com/amitsaha/gitbackup/vendor/src/src/github.com/spf13/afero
src/gitbackup/client.go:5:2: cannot find package "github.com/xanzy/go-gitlab" in any of:
/usr/local/Cellar/go/1.8/libexec/src/github.com/xanzy/go-gitlab (from $GOROOT)
/Users/asaha/work/github.com/amitsaha/gitbackup/src/src/github.com/xanzy/go-gitlab (from $GOPATH)
/Users/asaha/work/github.com/amitsaha/gitbackup/vendor/src/src/github.com/xanzy/go-gitlab
src/gitbackup/client.go:6:2: cannot find package "golang.org/x/oauth2" in any of:
/usr/local/Cellar/go/1.8/libexec/src/golang.org/x/oauth2 (from $GOROOT)
/Users/asaha/work/github.com/amitsaha/gitbackup/src/src/golang.org/x/oauth2 (from $GOPATH)
/Users/asaha/work/github.com/amitsaha/gitbackup/vendor/src/src/golang.org/x/oauth2
So I guess, the problem is it's looking for src
under the vendor/src
directory. So, this works:
$ env GOPATH=/Users/asaha/work/github.com/amitsaha/gitbackup/src:/Users/asaha/work/github.com/amitsaha/gitbackup/vendor/ go build src/gitbackup/main.go src/gitbackup/client.go src/gitbackup/backup.go src/gitbackup/repositories.go
And that allowed me to use promu build
as well. Closing this issue. Thanks.
Thanks, will be good to know if there was one I could use directly.