go-kod / kod

A generics based dependency injection application framework for Go, support OpenTelemetry trace/metric/log natively 🚀🚀🚀
https://pkg.go.dev/github.com/go-kod/kod
Apache License 2.0
128 stars 3 forks source link

`installer:mockgen` task is not valid #151

Closed ccoVeille closed 2 months ago

ccoVeille commented 2 months ago

Trying to launch go generate ./... showed me this also

cmd/kod/internal/watcher_test.go:12: running "mockgen": exec: "mockgen": executable file not found in $PATH

So I tried to use

$ task install:mockgen
task: Task "install:mockgen" is up to date

which is wrong as I don't have mockgen installed

      - go version -m $GOPATH/bin/mockgen | grep go.uber.org/mock | grep {{.VERSION}}

This code behaves wrongly when mockgen is not installed.

Also, this piece of code relies on GOPATH env variable, that is not always defined (my case). go env GOPATH should be preferred whenever needed.

Also, the installer checks for GOPATH/bin, while code will simply call mockgen directly, without a path so it should check for the presence of mockgen in PATH first