1
0
mirror of https://github.com/containers/buildah.git synced 2026-02-05 09:45:38 +01:00

use switch/case

Signed-off-by: iTrooz <hey@itrooz.fr>
This commit is contained in:
iTrooz
2025-12-03 10:44:18 +01:00
committed by Nalin Dahyabhai
parent b1c9ff5f32
commit 2badfa5fb2

View File

@@ -58,7 +58,8 @@ func ExportFromReader(input io.Reader, opts parse.BuildOutputOption) error {
return err
}
}
if opts.Type == parse.BuildOutputLocalDir {
switch opts.Type {
case parse.BuildOutputLocalDir:
// In order to keep this feature as close as possible to
// buildkit it was decided to preserve ownership when
// invoked as root since caller already has access to artifacts
@@ -78,7 +79,7 @@ func ExportFromReader(input io.Reader, opts parse.BuildOutputOption) error {
if err = chrootarchive.Untar(input, opts.Path, &archive.TarOptions{NoLchown: noLChown}); err != nil {
return fmt.Errorf("failed while performing untar at %q: %w", opts.Path, err)
}
} else {
case parse.BuildOutputTar, parse.BuildOutputStdout:
outFile := os.Stdout
if opts.Type != parse.BuildOutputStdout {
if outFile, err = os.Create(opts.Path); err != nil {