You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it's very hard to support coverage for the tested package and all the dependencies of that package.
In order to do this today, one would need to do something like this:
go test -coverpkg `go list -f {{.Deps}} | sed 's/\[//g' | sed 's/]//g' | sed 's/ /,/g'`,tested/package/name tested/package/name
The problem is that this would also list the standard library dependencies, which is not really useful and it's hard to write as well (see the fact that one needs to append the name of the tested package to actually get the coverage for it). The above command also doesn't work on Windows.
The other option would be to use:
go test -coverpkg PACKAGE_DIR/... tested/package/name
This however will not show dependencies from GOPATH.
As such, I'm proposing adding a magical keyword named deps (like all) to solve this problem. The way it should work would be:
go test -coverpkg deps tested/package/name
This comes up pretty often, see: https://youtrack.jetbrains.com/issue/GO-1541 for the number of voters / watchers or duplicate issues. It is true that the IDE could generate the list of packages but the users that do not use such a tool wouldn't be able to benefit from it.
Note that if everything is vendored (and unnecessary things are not vendored), what you want is "PACKAGE_DIR/vendor/...". There may end up being a syntax like that in the new package management work as well. Probably good to wait for that.
Currently it's very hard to support coverage for the tested package and all the dependencies of that package.
In order to do this today, one would need to do something like this:
The problem is that this would also list the standard library dependencies, which is not really useful and it's hard to write as well (see the fact that one needs to append the name of the tested package to actually get the coverage for it). The above command also doesn't work on Windows.
The other option would be to use:
This however will not show dependencies from GOPATH.
As such, I'm proposing adding a magical keyword named
deps
(likeall
) to solve this problem. The way it should work would be:This comes up pretty often, see: https://youtrack.jetbrains.com/issue/GO-1541 for the number of voters / watchers or duplicate issues. It is true that the IDE could generate the list of packages but the users that do not use such a tool wouldn't be able to benefit from it.
Please note this is different from #6909.
The text was updated successfully, but these errors were encountered: