goyek / goyek

Task automation Go library

Home Page:https://pkg.go.dev/github.com/goyek/goyek/v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Require cmd.Exec output to be sent to console and a file

dineshdh opened this issue · comments

Why

I have a requirement where I need to generate a report and upload it to an evidence store. Having the CI pipeline pass/fail is not sufficient. I want to know how I can output the cmd.Exec output to a file as well as the console

What

Here is what I have so far

var lint = goyek.Define(goyek.Task{
	Name:  "lint",
	Usage: "Preferred way to lint dashboards",
	Action: func(a *goyek.A) {
		cmd.Exec(a, "go test dashboards_test.go -v", cmd.Dir("../dashboards"))
	},
})

I really don't have a suggestion , and I'm sure there is a sensible way to achieve what I want, just not obvious to me at the moment.

Alternatives

Other