Skip to content

Commit

Permalink
feat: Run go mod download if required to build
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinblackman committed May 17, 2024
1 parent 7c9cf0a commit 5f02694
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ func GetCachedBin(pkgRoot, binName, cmdPath string) (string, error) {

moduleBinSrcPath := path.Join(goPath, "pkg", "mod", goModCmdPathVariant)
if _, err := os.Stat(moduleBinSrcPath); os.IsNotExist(err) {
return "", fmt.Errorf("module %s not downloaded. Run `go mod download`", cmdPath)
download := exec.Command("go", "mod", "download")
download.Dir = pkgRoot
err = download.Run()
if err != nil {
return "", err
}
}

moduleSrcRoot := moduleBinSrcPath
Expand Down

0 comments on commit 5f02694

Please sign in to comment.