mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
26 lines
457 B
Go
26 lines
457 B
Go
package gomods
|
|
|
|
import (
|
|
"os/exec"
|
|
|
|
"github.com/gobuffalo/genny"
|
|
)
|
|
|
|
func Tidy(path string, verbose bool) (*genny.Generator, error) {
|
|
g := genny.New()
|
|
g.StepName = "go:mod:tidy:" + path
|
|
g.RunFn(func(r *genny.Runner) error {
|
|
if !On() {
|
|
return nil
|
|
}
|
|
return r.Chdir(path, func() error {
|
|
cmd := exec.Command(genny.GoBin(), "mod", "tidy")
|
|
if verbose {
|
|
cmd.Args = append(cmd.Args, "-v")
|
|
}
|
|
return r.Exec(cmd)
|
|
})
|
|
})
|
|
return g, nil
|
|
}
|