"path/filepath"
"runtime"
"strings"
+ "sync"
"time"
"github.com/magefile/mage/mg"
fmt.Printf("Skip Check on %s\n", runtime.Version())
return
}
- mg.Deps(Test386, Fmt, Vet)
+
+ mg.Deps(Test386)
+
+ mg.Deps(Fmt, Vet)
+
// don't run two tests in parallel, they saturate the CPUs anyway, and running two
// causes memory issues in CI.
mg.Deps(TestRace)
return nil
}
-var pkgPrefixLen = len("github.com/gohugoio/hugo")
+var (
+ pkgPrefixLen = len("github.com/gohugoio/hugo")
+ pkgs []string
+ pkgsInit sync.Once
+)
func hugoPackages() ([]string, error) {
- s, err := sh.Output(goexe, "list", "./...")
- if err != nil {
- return nil, err
- }
- pkgs := strings.Split(s, "\n")
- for i := range pkgs {
- pkgs[i] = "." + pkgs[i][pkgPrefixLen:]
- }
- return pkgs, nil
+ var err error
+ pkgsInit.Do(func() {
+ var s string
+ s, err = sh.Output(goexe, "list", "./...")
+ if err != nil {
+ return
+ }
+ pkgs = strings.Split(s, "\n")
+ for i := range pkgs {
+ pkgs[i] = "." + pkgs[i][pkgPrefixLen:]
+ }
+ })
+ return pkgs, err
}
// Run golint linter