We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2156ade + 6f392ff commit cc56482Copy full SHA for cc56482
dep/cmd/cmd.go
@@ -236,6 +236,19 @@ func WithGoCode(modulePath, mainPkg string) Opt {
236
}
237
238
239
+// WithGoCover calls WithGoCoverDir with the os.Getenv("GOCOVERDIR") value if it's set.
240
+// Otherwise it's a no-op.
241
+func WithGoCove() Opt {
242
+ dir := os.Getenv("GOCOVERDIR")
243
+ if dir == "" {
244
+ return func(c *Cmd) error { return nil }
245
+ }
246
+
247
+ return WithGoCoverDir(dir)
248
+}
249
250
+// WithGoCoverDir creates the dir if it doesn't exist and
251
+// appends the GOCOVERDIR env variable into the commands env.
252
func WithGoCoverDir(dir string) Opt {
253
return func(c *Cmd) error {
254
if err := os.MkdirAll(dir, 0o755); err != nil {
0 commit comments