From b71b230bdb378c6fb0fedd3faf37211f11afe530 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sat, 9 Sep 2023 15:38:20 +0700 Subject: lib/git: replace lib/test/mock with bytes.Buffer This changes require changing the internal type of _stdout and _stderr from *os.File to io.Reader. The reason of replacing lib/test/mock is to minimize read/write to file, since mock.Stdin/Stderr is a temporary files. --- lib/git/git.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/git/git.go') diff --git a/lib/git/git.go b/lib/git/git.go index 963bdf6e..78a44e28 100644 --- a/lib/git/git.go +++ b/lib/git/git.go @@ -8,6 +8,7 @@ package git import ( "bytes" "fmt" + "io" "os" "os/exec" "path/filepath" @@ -22,8 +23,8 @@ const ( ) var ( - _stdout = os.Stdout - _stderr = os.Stderr + _stdout io.Writer = os.Stdout + _stderr io.Writer = os.Stderr ) // CheckoutRevision will set the HEAD to specific revision on specific branch. -- cgit v1.3-6-g1900