Skip to content

Go: Ignore ephemeral packages when checking transitive dependencies #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions pkg/leeway/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -1121,11 +1121,25 @@ func (p *Package) buildGo(buildctx *buildContext, wd, result string) (res *packa
}...)
}

// We don't check if ephemeral packages in the transitive dependency tree have been built,
// as they may be too far down the tree to trigger a build (e.g. their parent may be built already).
// Hence, we need to ensure all direct dependencies on ephemeral packages have been built.
for _, deppkg := range p.GetDependencies() {
_, ok := buildctx.LocalCache.Location(deppkg)
if deppkg.Ephemeral && !ok {
return nil, PkgNotBuiltErr{deppkg}
}
}

transdep := p.GetTransitiveDependencies()
if len(transdep) > 0 {
commands = append(commands, []string{"mkdir", "_deps"})

for _, dep := range transdep {
if dep.Ephemeral {
continue
}

builtpkg, ok := buildctx.LocalCache.Location(dep)
if !ok {
return nil, PkgNotBuiltErr{dep}
Expand Down