From ce85ecb176d38362697614d6efa23591b7cf688e Mon Sep 17 00:00:00 2001 From: Usta Shrestha Date: Fri, 17 Feb 2023 17:52:47 -0500 Subject: [PATCH] cosmetic: readability Test: run `m nothing` and `m nothing --empty_ninja_file` Bug: NA Change-Id: I6fd81667ea2d636139ae38bc36315f8710b72c25 --- bootstrap/command.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bootstrap/command.go b/bootstrap/command.go index 46f6564..3c41cce 100644 --- a/bootstrap/command.go +++ b/bootstrap/command.go @@ -139,9 +139,8 @@ func RunBlueprint(args Args, stopBefore StopBefore, ctx *blueprint.Context, conf if err := os.WriteFile(joinPath(ctx.SrcDir(), args.OutFile), []byte(nil), outFilePermissions); err != nil { fatalf("error writing empty Ninja file: %s", err) } - } - - if !args.EmptyNinjaFile { + out = io.Discard.(io.StringWriter) + } else { f, err := os.OpenFile(joinPath(ctx.SrcDir(), args.OutFile), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, outFilePermissions) if err != nil { fatalf("error opening Ninja file: %s", err) @@ -149,8 +148,6 @@ func RunBlueprint(args Args, stopBefore StopBefore, ctx *blueprint.Context, conf defer f.Close() buf = bufio.NewWriterSize(f, 16*1024*1024) out = buf - } else { - out = io.Discard.(io.StringWriter) } if err := ctx.WriteBuildFile(out); err != nil {