Skip to content

Commit 9a5cbc8

Browse files
leodidoona-agent
andcommitted
refactor: remove unreachable nil checks for ExportToCache
The determineDockerExportMode() function always sets cfg.ExportToCache to a non-nil value before these conditions are evaluated, making the nil checks unreachable dead code. Simplified: - Line 1958: (cfg.ExportToCache == nil || !*cfg.ExportToCache) → !*cfg.ExportToCache - Line 2015: cfg.ExportToCache != nil && *cfg.ExportToCache → *cfg.ExportToCache Co-authored-by: Ona <no-reply@ona.com>
1 parent 3fcdf06 commit 9a5cbc8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/leeway/build.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,7 @@ func (p *Package) buildDocker(buildctx *buildContext, wd, result string) (res *p
19551955
))
19561956

19571957
commands[PackageBuildPhasePackage] = pkgcmds
1958-
} else if len(cfg.Image) > 0 && (cfg.ExportToCache == nil || !*cfg.ExportToCache) {
1958+
} else if len(cfg.Image) > 0 && !*cfg.ExportToCache {
19591959
// Image push workflow
19601960
log.WithField("images", cfg.Image).Debug("configuring image push (legacy behavior)")
19611961

@@ -2012,7 +2012,7 @@ func (p *Package) buildDocker(buildctx *buildContext, wd, result string) (res *p
20122012

20132013
// Add subjects function for provenance generation
20142014
res.Subjects = createDockerSubjectsFunction(version, cfg)
2015-
} else if len(cfg.Image) > 0 && cfg.ExportToCache != nil && *cfg.ExportToCache {
2015+
} else if len(cfg.Image) > 0 && *cfg.ExportToCache {
20162016
// Export to cache for signing
20172017
log.WithField("package", p.FullName()).Debug("Exporting Docker image to cache")
20182018

0 commit comments

Comments
 (0)