diff options
author | Bryan C. Mills <bcmills@google.com> | 2018-11-27 08:50:28 -0500 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2018-11-29 18:18:51 +0000 |
commit | ba2e8f65ab36f145177419c56cc03adf67f0e167 (patch) | |
tree | 7d7ac889d63f59600f3e9bd37c0f89ae7df1c56f /src/cmd/go/internal/modfetch/coderepo_test.go | |
parent | c124a919716fd54f9b16b83fa94f68b0c8fc4681 (diff) | |
download | go-ba2e8f65ab36f145177419c56cc03adf67f0e167.tar.gz go-ba2e8f65ab36f145177419c56cc03adf67f0e167.zip |
cmd/go/internal/modfetch: make Repo.Zip write to an io.Writer instead of a temporary file
This will be used to eliminate a redundant copy in CL 145178.
(It also decouples two design points that were previously coupled: the
destination of the zip output and the program logic to write that
output.)
Updates #26794
Change-Id: I6cfd5a33c162c0016a1b83a278003684560a3772
Reviewed-on: https://go-review.googlesource.com/c/151341
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd/go/internal/modfetch/coderepo_test.go')
-rw-r--r-- | src/cmd/go/internal/modfetch/coderepo_test.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modfetch/coderepo_test.go b/src/cmd/go/internal/modfetch/coderepo_test.go index 73c4bd2cca..e8bf8ed750 100644 --- a/src/cmd/go/internal/modfetch/coderepo_test.go +++ b/src/cmd/go/internal/modfetch/coderepo_test.go @@ -391,7 +391,13 @@ func TestCodeRepo(t *testing.T) { } } if tt.zip != nil || tt.ziperr != "" { - zipfile, err := repo.Zip(tt.version, tmpdir) + f, err := ioutil.TempFile(tmpdir, tt.version+".zip.") + if err != nil { + t.Fatalf("ioutil.TempFile: %v", err) + } + zipfile := f.Name() + err = repo.Zip(f, tt.version) + f.Close() if err != nil { if tt.ziperr != "" { if err.Error() == tt.ziperr { |