aboutsummaryrefslogtreecommitdiff
path: root/lib/git/git.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-09-09 15:38:20 +0700
committerShulhan <ms@kilabit.info>2023-09-09 15:38:20 +0700
commitb71b230bdb378c6fb0fedd3faf37211f11afe530 (patch)
tree827370a35fafcb2d415f811f98d1af794ff6533c /lib/git/git.go
parented962926fd02987a1ba98c538e292d94a1a4894b (diff)
downloadpakakeh.go-b71b230bdb378c6fb0fedd3faf37211f11afe530.tar.xz
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.
Diffstat (limited to 'lib/git/git.go')
-rw-r--r--lib/git/git.go5
1 files changed, 3 insertions, 2 deletions
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.