Skip to content

Commit

Permalink
Tolerate "errornous" packages in go list
Browse files Browse the repository at this point in the history
Fixes: #204
  • Loading branch information
Reinhard Tartler authored and anthonyfok committed Mar 22, 2024
1 parent 989837a commit f0abee6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions make.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (u *upstream) tar(gopath, repo string) error {
// findMains finds main packages within the repo (useful to auto-detect the
// package type).
func (u *upstream) findMains(gopath, repo string) error {
cmd := exec.Command("go", "list", "-f", "{{.ImportPath}} {{.Name}}", repo+"/...")
cmd := exec.Command("go", "list", "-e", "-f", "{{.ImportPath}} {{.Name}}", repo+"/...")
cmd.Stderr = os.Stderr
cmd.Env = append([]string{
"GO111MODULE=off",
Expand All @@ -226,7 +226,7 @@ func (u *upstream) findMains(gopath, repo string) error {
if err != nil {
log.Println("WARNING: In findMains:", fmt.Errorf("%q: %w", cmd.Args, err))
log.Printf("Retrying without appending \"/...\" to repo")
cmd = exec.Command("go", "list", "-f", "{{.ImportPath}} {{.Name}}", repo)
cmd = exec.Command("go", "list", "-e", "-f", "{{.ImportPath}} {{.Name}}", repo)
cmd.Stderr = os.Stderr
cmd.Env = append([]string{
"GO111MODULE=off",
Expand Down Expand Up @@ -256,7 +256,7 @@ func (u *upstream) findMains(gopath, repo string) error {
func (u *upstream) findDependencies(gopath, repo string) error {
log.Printf("Determining dependencies\n")

cmd := exec.Command("go", "list", "-f", "{{join .Imports \"\\n\"}}\n{{join .TestImports \"\\n\"}}\n{{join .XTestImports \"\\n\"}}", repo+"/...")
cmd := exec.Command("go", "list", "-e", "-f", "{{join .Imports \"\\n\"}}\n{{join .TestImports \"\\n\"}}\n{{join .XTestImports \"\\n\"}}", repo+"/...")
cmd.Stderr = os.Stderr
cmd.Env = append([]string{
"GO111MODULE=off",
Expand All @@ -267,7 +267,7 @@ func (u *upstream) findDependencies(gopath, repo string) error {
if err != nil {
log.Println("WARNING: In findDependencies:", fmt.Errorf("%q: %w", cmd.Args, err))
log.Printf("Retrying without appending \"/...\" to repo")
cmd = exec.Command("go", "list", "-f", "{{join .Imports \"\\n\"}}\n{{join .TestImports \"\\n\"}}\n{{join .XTestImports \"\\n\"}}", repo)
cmd = exec.Command("go", "list", "-e", "-f", "{{join .Imports \"\\n\"}}\n{{join .TestImports \"\\n\"}}\n{{join .XTestImports \"\\n\"}}", repo)
cmd.Stderr = os.Stderr
cmd.Env = append([]string{
"GO111MODULE=off",
Expand Down

0 comments on commit f0abee6

Please sign in to comment.