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 committed Mar 21, 2024
1 parent e701253 commit c992dff
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 @@ -216,7 +216,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 @@ -227,7 +227,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 @@ -257,7 +257,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 @@ -268,7 +268,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 c992dff

Please sign in to comment.