Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions dep/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,19 @@
}
}

// WithGoCover calls WithGoCoverDir with the os.Getenv("GOCOVERDIR") value if it's set.
// Otherwise it's a no-op.
func WithGoCove() Opt {
dir := os.Getenv("GOCOVERDIR")
if dir == "" {
return func(c *Cmd) error { return nil }

Check warning on line 244 in dep/cmd/cmd.go

View check run for this annotation

Codecov / codecov/patch

dep/cmd/cmd.go#L241-L244

Added lines #L241 - L244 were not covered by tests
}

return WithGoCoverDir(dir)

Check warning on line 247 in dep/cmd/cmd.go

View check run for this annotation

Codecov / codecov/patch

dep/cmd/cmd.go#L247

Added line #L247 was not covered by tests
}

// WithGoCoverDir creates the dir if it doesn't exist and
// appends the GOCOVERDIR env variable into the commands env.
func WithGoCoverDir(dir string) Opt {
return func(c *Cmd) error {
if err := os.MkdirAll(dir, 0o755); err != nil {
Expand Down