joshuarubin / zb

an opinionated repo based tool for linting, testing and building go source
https://jrubin.io/zb
MIT License
110 stars 4 forks source link

`zb build` doesn't report about missing dependencies errors #14

Open robert-zaremba opened 7 years ago

robert-zaremba commented 7 years ago

How to replicate:

It will return quietly without reporting error about missing dependencies. If you run go build (eg inside the log15/example package) it will return with errors.

joshuarubin commented 7 years ago

Hmm... when I tried that I get this:

% zb build
ERROR cannot find package "github.com/davecgh/go-spew/spew" in any of:
ERROR   /Users/jrubin/.gvm/gos/go1.9/src/github.com/davecgh/go-spew/spew (from $GOROOT)
ERROR   /Users/jrubin/tmp-go/src/github.com/davecgh/go-spew/spew (from $GOPATH)

I thought it might be something in my environment, but it doesn't seem so:

% env -i GOPATH="${GOPATH}" PATH="${PATH}" zb build
level=ERROR msg="cannot find package \"github.com/davecgh/go-spew/spew\" in any of:"
level=ERROR msg="\t/Users/jrubin/.gvm/gos/go1.8.3/src/github.com/davecgh/go-spew/spew (from $GOROOT)"
level=ERROR msg="\t/Users/jrubin/tmp-go/src/github.com/davecgh/go-spew/spew (from $GOPATH)"
robert-zaremba commented 7 years ago

This is my output:

% cd ~
~ % mkdir ~/tmp-go

~ % export GOPATH=~/tmp-go

~ % git clone https://github.com/robert-zaremba/log15.git ~/tmp-go/src/github.com/robert-zaremba/log15
Cloning into '/home/robert/tmp-go/src/github.com/robert-zaremba/log15'...
remote: Counting objects: 624, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 624 (delta 0), reused 12 (delta 0), pack-reused 604
Receiving objects: 100% (624/624), 195.49 KiB | 0 bytes/s, done.
Resolving deltas: 100% (343/343), done.

robert@rz-thinkpad ~ % cd ~/tmp-go/src/github.com/robert-zaremba/log15

...github.com/robert-zaremba/log15 (git master)% zb build

...github.com/robert-zaremba/log15 (git master)% ls
bench_test.go  caller_test.go  doc.go   ext        format-terminal.go       handler.go       handler_go14.go  LICENSE        logger.go  reg.go   root.go    term
caller.go      CONTRIBUTORS    example  format.go  format-terminal_test.go  handler_go13.go  init_test.go     log15_test.go  README.md  rollbar  syslog.go  writer.go

...github.com/robert-zaremba/log15 (git master)% cd example 

...robert-zaremba/log15/example (git master)% go build
../format-terminal.go:9:2: cannot find package "github.com/davecgh/go-spew/spew" in any of:
        /usr/lib/golang/src/github.com/davecgh/go-spew/spew (from $GOROOT)
        /home/robert/tmp-go/src/github.com/davecgh/go-spew/spew (from $GOPATH)
example.go:7:2: cannot find package "github.com/facebookgo/stack" in any of:
        /usr/lib/golang/src/github.com/facebookgo/stack (from $GOROOT)
        /home/robert/tmp-go/src/github.com/facebookgo/stack (from $GOPATH)
../caller.go:7:2: cannot find package "github.com/go-stack/stack" in any of:
        /usr/lib/golang/src/github.com/go-stack/stack (from $GOROOT)
        /home/robert/tmp-go/src/github.com/go-stack/stack (from $GOPATH)
../root.go:6:2: cannot find package "github.com/mattn/go-colorable" in any of:
        /usr/lib/golang/src/github.com/mattn/go-colorable (from $GOROOT)
        /home/robert/tmp-go/src/github.com/mattn/go-colorable (from $GOPATH)
example.go:8:2: cannot find package "github.com/robert-zaremba/errstack" in any of:
        /usr/lib/golang/src/github.com/robert-zaremba/errstack (from $GOROOT)
        /home/robert/tmp-go/src/github.com/robert-zaremba/errstack (from $GOPATH)
../format-terminal.go:11:2: cannot find package "github.com/robert-zaremba/go-tty" in any of:
        /usr/lib/golang/src/github.com/robert-zaremba/go-tty (from $GOROOT)
        /home/robert/tmp-go/src/github.com/robert-zaremba/go-tty (from $GOPATH)

I tested it on Fedora 26 and Ubuntu 16.04

joshuarubin commented 7 years ago

I've been testing on Mac, it might be a Linux specific issue. What do you get when you run: LOG_LEVEL=debug zb build?

robert-zaremba commented 7 years ago

Also nothing. I've tried zb -l DEBUG build as well.

robert-zaremba commented 7 years ago

Are you sure you export GOPATH=~/tmp-go? I've tested it with a friend on Mac and he has the same issue.

joshuarubin commented 7 years ago

Yes, my $GOPATH is set just as yours is. I still can't reproduce. You are running the current zb from the master branch? What version of Go?