您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何在运行“ go test”时排除或跳过特定目录

如何在运行“ go test”时排除或跳过特定目录

您已经在做:

$(go list ./... | grep -v /vendor/)

grep -v /vendor/部分是排除/vendor/目录。因此,只需对您的Store目录执行相同的操作:

go test $(go list ./... | grep -v /Store/) -coverprofile .testCoverage.txt

请注意,/vendor/不必排除这种方式(除非您使用的是Go的真正旧版本)。如果您使用的是旧版Go,则可以将它们结合使用:

go test $(go list ./... | grep -v /vendor/ | grep -v /Store/) -coverprofile .testCoverage.txt
Go 2022/1/1 18:20:32 有499人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶