Skip to content

Go autobuild tries to download module dependencies twice #11991

@cbandy

Description

@cbandy

Description of the issue

I noticed in my Go project that autobuild successfully downloads Go modules then reports Dependencies are still not resolving after the build.

…
  2023/01/24 18:14:22 Found go.mod, enabling go modules
  go: downloading k8s.io/api v0.24.2
  go: downloading k8s.io/apimachinery v0.24.2
  go: downloading k8s.io/client-go v0.24.2
…
  2023/01/24 18:14:32 Import path is 'github.com/CrunchyData/postgres-operator'
  2023/01/24 18:14:32 Makefile found.
  2023/01/24 18:14:32 Trying build command make []
…
  2023/01/24 18:14:33 Dependencies are still not resolving after the build, continuing to install dependencies.
  2023/01/24 18:14:33 Installing dependencies using `go get -v ./...`.
  2023/01/24 18:14:35 Running extractor command…
…

🤔 go mod tidy downloads dependencies, so I don't expect go get needs to be called.

🤔 Is the following code correct? It seems to print error exactly when .DepsErrors is empty.

// DepErrors checks there are any errors resolving dependencies for `pkgpath`. It passes the `go
// list` command the flags specified by `flags`.
func DepErrors(pkgpath string, flags ...string) bool {
out, err := runGoList("{{if .DepsErrors}}{{else}}error{{end}}", []string{pkgpath}, flags...)
if err != nil {
// if go list failed, assume dependencies are broken
return false
}
return out != ""
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions