robfig / glock

MIT License
230 stars 27 forks source link

Add a sync verbose option. #19

Closed clutchski closed 9 years ago

clutchski commented 9 years ago

This adds a verbose option to the sync cmd, which prints the contents of any install errors.

For example:

$ glock sync my/repo
cmd github.com/golang/tools/cmd/vet                             [error exit status 2]

$ glock sync -v my/repo
cmd github.com/golang/tools/cmd/vet                             [error exit status 2]
github.com/golang/tools/cmd/vet
# github.com/golang/tools/cmd/vet
/home/vagrant/code/datadog/go/src/github.com/golang/tools/cmd/vet/bool.go:167: undefined: astutil.Unparen

It looks like the syncPkg errors are already well-covered so I didn't add anything there, but if you think there's something to add, I can. Another option is to always print the actual error contents, since you'd pretty much always want to see them.

clutchski commented 9 years ago

Just realized that sync returns with 0 error code if one of the installs fail. Maybe it's just easier to call perror with the output and then it's consistent with the rest of the tool? Up to you.

robfig commented 9 years ago

I think it makes sense to always print the output if there was an error. Yeah, if an install fails it should return non-0

clutchski commented 9 years ago

Ok. Will submit another one.