aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing')
-rw-r--r--plumbing/format/gitattributes/attributes.go3
-rw-r--r--plumbing/format/gitignore/dir.go4
-rw-r--r--plumbing/format/idxfile/decoder_test.go3
-rw-r--r--plumbing/format/idxfile/encoder_test.go4
-rw-r--r--plumbing/format/idxfile/writer_test.go6
-rw-r--r--plumbing/format/index/decoder.go4
-rw-r--r--plumbing/format/objfile/reader_test.go3
-rw-r--r--plumbing/format/packfile/delta_test.go10
-rw-r--r--plumbing/format/packfile/encoder_test.go5
-rw-r--r--plumbing/format/packfile/parser.go3
-rw-r--r--plumbing/format/packfile/scanner.go5
-rw-r--r--plumbing/memory_test.go5
-rw-r--r--plumbing/object/blob_test.go7
-rw-r--r--plumbing/object/commit_test.go5
-rw-r--r--plumbing/object/object_test.go3
-rw-r--r--plumbing/object/tag_test.go3
-rw-r--r--plumbing/protocol/packp/sideband/demux_test.go3
-rw-r--r--plumbing/protocol/packp/updreq_decode.go3
-rw-r--r--plumbing/protocol/packp/updreq_decode_test.go15
-rw-r--r--plumbing/protocol/packp/updreq_encode_test.go5
-rw-r--r--plumbing/protocol/packp/uppackresp_test.go20
-rw-r--r--plumbing/transport/file/common_test.go3
-rw-r--r--plumbing/transport/git/common_test.go3
-rw-r--r--plumbing/transport/http/common_test.go3
-rw-r--r--plumbing/transport/http/upload_pack_test.go4
-rw-r--r--plumbing/transport/internal/common/common.go3
-rw-r--r--plumbing/transport/ssh/auth_method.go3
-rw-r--r--plumbing/transport/ssh/internal/test/proxy_test.go3
-rw-r--r--plumbing/transport/ssh/proxy_test.go3
-rw-r--r--plumbing/transport/ssh/upload_pack_test.go3
-rw-r--r--plumbing/transport/test/receive_pack.go6
-rw-r--r--plumbing/transport/test/upload_pack.go6
32 files changed, 66 insertions, 93 deletions
diff --git a/plumbing/format/gitattributes/attributes.go b/plumbing/format/gitattributes/attributes.go
index 329e667..d36ec1b 100644
--- a/plumbing/format/gitattributes/attributes.go
+++ b/plumbing/format/gitattributes/attributes.go
@@ -3,7 +3,6 @@ package gitattributes
import (
"errors"
"io"
- "io/ioutil"
"strings"
)
@@ -89,7 +88,7 @@ func (a attribute) String() string {
// ReadAttributes reads patterns and attributes from the gitattributes format.
func ReadAttributes(r io.Reader, domain []string, allowMacro bool) (attributes []MatchAttribute, err error) {
- data, err := ioutil.ReadAll(r)
+ data, err := io.ReadAll(r)
if err != nil {
return nil, err
}
diff --git a/plumbing/format/gitignore/dir.go b/plumbing/format/gitignore/dir.go
index 15bc9c7..bb78655 100644
--- a/plumbing/format/gitignore/dir.go
+++ b/plumbing/format/gitignore/dir.go
@@ -3,7 +3,7 @@ package gitignore
import (
"bufio"
"bytes"
- "io/ioutil"
+ "io"
"os"
"strings"
@@ -86,7 +86,7 @@ func loadPatterns(fs billy.Filesystem, path string) (ps []Pattern, err error) {
defer gioutil.CheckClose(f, &err)
- b, err := ioutil.ReadAll(f)
+ b, err := io.ReadAll(f)
if err != nil {
return
}
diff --git a/plumbing/format/idxfile/decoder_test.go b/plumbing/format/idxfile/decoder_test.go
index 94059cc..2c4a801 100644
--- a/plumbing/format/idxfile/decoder_test.go
+++ b/plumbing/format/idxfile/decoder_test.go
@@ -5,7 +5,6 @@ import (
"encoding/base64"
"fmt"
"io"
- "io/ioutil"
"testing"
"github.com/go-git/go-git/v5/plumbing"
@@ -119,7 +118,7 @@ ch2xUA==
func BenchmarkDecode(b *testing.B) {
f := fixtures.Basic().One()
- fixture, err := ioutil.ReadAll(f.Idx())
+ fixture, err := io.ReadAll(f.Idx())
if err != nil {
b.Errorf("unexpected error reading idx file: %s", err)
}
diff --git a/plumbing/format/idxfile/encoder_test.go b/plumbing/format/idxfile/encoder_test.go
index 32b60f9..b8ece83 100644
--- a/plumbing/format/idxfile/encoder_test.go
+++ b/plumbing/format/idxfile/encoder_test.go
@@ -2,7 +2,7 @@ package idxfile_test
import (
"bytes"
- "io/ioutil"
+ "io"
. "github.com/go-git/go-git/v5/plumbing/format/idxfile"
@@ -12,7 +12,7 @@ import (
func (s *IdxfileSuite) TestDecodeEncode(c *C) {
fixtures.ByTag("packfile").Test(c, func(f *fixtures.Fixture) {
- expected, err := ioutil.ReadAll(f.Idx())
+ expected, err := io.ReadAll(f.Idx())
c.Assert(err, IsNil)
idx := new(MemoryIndex)
diff --git a/plumbing/format/idxfile/writer_test.go b/plumbing/format/idxfile/writer_test.go
index fba3e42..eaa8605 100644
--- a/plumbing/format/idxfile/writer_test.go
+++ b/plumbing/format/idxfile/writer_test.go
@@ -3,7 +3,7 @@ package idxfile_test
import (
"bytes"
"encoding/base64"
- "io/ioutil"
+ "io"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/format/idxfile"
@@ -34,7 +34,7 @@ func (s *WriterSuite) TestWriter(c *C) {
c.Assert(err, IsNil)
idxFile := f.Idx()
- expected, err := ioutil.ReadAll(idxFile)
+ expected, err := io.ReadAll(idxFile)
c.Assert(err, IsNil)
idxFile.Close()
@@ -65,7 +65,7 @@ func (s *WriterSuite) TestWriterLarge(c *C) {
// load fixture index
f := bytes.NewBufferString(fixtureLarge4GB)
- expected, err := ioutil.ReadAll(base64.NewDecoder(base64.StdEncoding, f))
+ expected, err := io.ReadAll(base64.NewDecoder(base64.StdEncoding, f))
c.Assert(err, IsNil)
buf := new(bytes.Buffer)
diff --git a/plumbing/format/index/decoder.go b/plumbing/format/index/decoder.go
index 8834e25..6778cf7 100644
--- a/plumbing/format/index/decoder.go
+++ b/plumbing/format/index/decoder.go
@@ -5,7 +5,7 @@ import (
"bytes"
"errors"
"io"
- "io/ioutil"
+
"strconv"
"time"
@@ -201,7 +201,7 @@ func (d *Decoder) padEntry(idx *Index, e *Entry, read int) error {
entrySize := read + len(e.Name)
padLen := 8 - entrySize%8
- _, err := io.CopyN(ioutil.Discard, d.r, int64(padLen))
+ _, err := io.CopyN(io.Discard, d.r, int64(padLen))
return err
}
diff --git a/plumbing/format/objfile/reader_test.go b/plumbing/format/objfile/reader_test.go
index d697d54..5526f7f 100644
--- a/plumbing/format/objfile/reader_test.go
+++ b/plumbing/format/objfile/reader_test.go
@@ -5,7 +5,6 @@ import (
"encoding/base64"
"fmt"
"io"
- "io/ioutil"
"github.com/go-git/go-git/v5/plumbing"
@@ -36,7 +35,7 @@ func testReader(c *C, source io.Reader, hash plumbing.Hash, t plumbing.ObjectTyp
c.Assert(typ, Equals, t)
c.Assert(content, HasLen, int(size))
- rc, err := ioutil.ReadAll(r)
+ rc, err := io.ReadAll(r)
c.Assert(err, IsNil)
c.Assert(rc, DeepEquals, content, Commentf("%scontent=%s, expected=%s", base64.StdEncoding.EncodeToString(rc), base64.StdEncoding.EncodeToString(content)))
diff --git a/plumbing/format/packfile/delta_test.go b/plumbing/format/packfile/delta_test.go
index 137e485..e8f5ea6 100644
--- a/plumbing/format/packfile/delta_test.go
+++ b/plumbing/format/packfile/delta_test.go
@@ -2,7 +2,7 @@ package packfile
import (
"bytes"
- "io/ioutil"
+ "io"
"math/rand"
"github.com/go-git/go-git/v5/plumbing"
@@ -109,14 +109,14 @@ func (s *DeltaSuite) TestAddDeltaReader(c *C) {
targetBuf := genBytes(t.target)
delta := DiffDelta(baseBuf, targetBuf)
- deltaRC := ioutil.NopCloser(bytes.NewReader(delta))
+ deltaRC := io.NopCloser(bytes.NewReader(delta))
c.Log("Executing test case:", t.description)
resultRC, err := ReaderFromDelta(baseObj, deltaRC)
c.Assert(err, IsNil)
- result, err := ioutil.ReadAll(resultRC)
+ result, err := io.ReadAll(resultRC)
c.Assert(err, IsNil)
err = resultRC.Close()
@@ -164,12 +164,12 @@ func (s *DeltaSuite) TestMaxCopySizeDeltaReader(c *C) {
targetBuf = append(targetBuf, byte(1))
delta := DiffDelta(baseBuf, targetBuf)
- deltaRC := ioutil.NopCloser(bytes.NewReader(delta))
+ deltaRC := io.NopCloser(bytes.NewReader(delta))
resultRC, err := ReaderFromDelta(baseObj, deltaRC)
c.Assert(err, IsNil)
- result, err := ioutil.ReadAll(resultRC)
+ result, err := io.ReadAll(resultRC)
c.Assert(err, IsNil)
err = resultRC.Close()
diff --git a/plumbing/format/packfile/encoder_test.go b/plumbing/format/packfile/encoder_test.go
index 902d8cc..6719f37 100644
--- a/plumbing/format/packfile/encoder_test.go
+++ b/plumbing/format/packfile/encoder_test.go
@@ -3,7 +3,6 @@ package packfile
import (
"bytes"
"io"
- stdioutil "io/ioutil"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/format/idxfile"
@@ -278,13 +277,13 @@ func objectsEqual(c *C, o1, o2 plumbing.EncodedObject) {
r1, err := o1.Reader()
c.Assert(err, IsNil)
- b1, err := stdioutil.ReadAll(r1)
+ b1, err := io.ReadAll(r1)
c.Assert(err, IsNil)
r2, err := o2.Reader()
c.Assert(err, IsNil)
- b2, err := stdioutil.ReadAll(r2)
+ b2, err := io.ReadAll(r2)
c.Assert(err, IsNil)
c.Assert(bytes.Compare(b1, b2), Equals, 0)
diff --git a/plumbing/format/packfile/parser.go b/plumbing/format/packfile/parser.go
index 6012b04..edbc0e7 100644
--- a/plumbing/format/packfile/parser.go
+++ b/plumbing/format/packfile/parser.go
@@ -4,7 +4,6 @@ import (
"bytes"
"errors"
"io"
- stdioutil "io/ioutil"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/cache"
@@ -297,7 +296,7 @@ func (p *Parser) resolveDeltas() error {
if !obj.IsDelta() && len(obj.Children) > 0 {
for _, child := range obj.Children {
- if err := p.resolveObject(stdioutil.Discard, child, content); err != nil {
+ if err := p.resolveObject(io.Discard, child, content); err != nil {
return err
}
p.resolveExternalRef(child)
diff --git a/plumbing/format/packfile/scanner.go b/plumbing/format/packfile/scanner.go
index 9ebb84a..730343e 100644
--- a/plumbing/format/packfile/scanner.go
+++ b/plumbing/format/packfile/scanner.go
@@ -7,7 +7,6 @@ import (
"hash"
"hash/crc32"
"io"
- stdioutil "io/ioutil"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/utils/binary"
@@ -242,7 +241,7 @@ func (s *Scanner) discardObjectIfNeeded() error {
}
h := s.pendingObject
- n, _, err := s.NextObject(stdioutil.Discard)
+ n, _, err := s.NextObject(io.Discard)
if err != nil {
return err
}
@@ -381,7 +380,7 @@ func (s *Scanner) Checksum() (plumbing.Hash, error) {
// Close reads the reader until io.EOF
func (s *Scanner) Close() error {
buf := sync.GetByteSlice()
- _, err := io.CopyBuffer(stdioutil.Discard, s.r, *buf)
+ _, err := io.CopyBuffer(io.Discard, s.r, *buf)
sync.PutByteSlice(buf)
return err
diff --git a/plumbing/memory_test.go b/plumbing/memory_test.go
index 2a141f4..f76b4f4 100644
--- a/plumbing/memory_test.go
+++ b/plumbing/memory_test.go
@@ -2,7 +2,6 @@ package plumbing
import (
"io"
- "io/ioutil"
. "gopkg.in/check.v1"
)
@@ -52,7 +51,7 @@ func (s *MemoryObjectSuite) TestReader(c *C) {
c.Assert(err, IsNil)
defer func() { c.Assert(reader.Close(), IsNil) }()
- b, err := ioutil.ReadAll(reader)
+ b, err := io.ReadAll(reader)
c.Assert(err, IsNil)
c.Assert(b, DeepEquals, []byte("foo"))
}
@@ -75,7 +74,7 @@ func (s *MemoryObjectSuite) TestSeekableReader(c *C) {
_, err = rs.Seek(pageSize, io.SeekStart)
c.Assert(err, IsNil)
- b, err := ioutil.ReadAll(rs)
+ b, err := io.ReadAll(rs)
c.Assert(err, IsNil)
c.Assert(b, DeepEquals, []byte(payload))
diff --git a/plumbing/object/blob_test.go b/plumbing/object/blob_test.go
index 4461343..9481dbe 100644
--- a/plumbing/object/blob_test.go
+++ b/plumbing/object/blob_test.go
@@ -3,7 +3,6 @@ package object
import (
"bytes"
"io"
- "io/ioutil"
"github.com/go-git/go-git/v5/plumbing"
@@ -37,7 +36,7 @@ func (s *BlobsSuite) TestBlobHash(c *C) {
c.Assert(err, IsNil)
defer func() { c.Assert(reader.Close(), IsNil) }()
- data, err := ioutil.ReadAll(reader)
+ data, err := io.ReadAll(reader)
c.Assert(err, IsNil)
c.Assert(string(data), Equals, "FOO")
}
@@ -96,14 +95,14 @@ func (s *BlobsSuite) TestBlobIter(c *C) {
r1, err := b.Reader()
c.Assert(err, IsNil)
- b1, err := ioutil.ReadAll(r1)
+ b1, err := io.ReadAll(r1)
c.Assert(err, IsNil)
c.Assert(r1.Close(), IsNil)
r2, err := blobs[i].Reader()
c.Assert(err, IsNil)
- b2, err := ioutil.ReadAll(r2)
+ b2, err := io.ReadAll(r2)
c.Assert(err, IsNil)
c.Assert(r2.Close(), IsNil)
diff --git a/plumbing/object/commit_test.go b/plumbing/object/commit_test.go
index 468a751..a939bc6 100644
--- a/plumbing/object/commit_test.go
+++ b/plumbing/object/commit_test.go
@@ -4,7 +4,6 @@ import (
"bytes"
"context"
"io"
- "io/ioutil"
"strings"
"time"
@@ -449,7 +448,7 @@ YIefGtzXfldDxg4=
`
e, err := commit.Verify(armoredKeyRing)
- c.Assert(err, IsNil)
+ c.Assert(err, IsNil)
_, ok := e.Identities["go-git test key"]
c.Assert(ok, Equals, true)
@@ -492,7 +491,7 @@ func (s *SuiteCommit) TestEncodeWithoutSignature(c *C) {
c.Assert(err, IsNil)
er, err := encoded.Reader()
c.Assert(err, IsNil)
- payload, err := ioutil.ReadAll(er)
+ payload, err := io.ReadAll(er)
c.Assert(err, IsNil)
c.Assert(string(payload), Equals, ""+
diff --git a/plumbing/object/object_test.go b/plumbing/object/object_test.go
index 6c95eef..c4fdb4c 100644
--- a/plumbing/object/object_test.go
+++ b/plumbing/object/object_test.go
@@ -2,7 +2,6 @@ package object
import (
"io"
- "io/ioutil"
"testing"
"time"
@@ -103,7 +102,7 @@ func (s *ObjectsSuite) TestParseTree(c *C) {
reader, err := f.Reader()
c.Assert(err, IsNil)
defer func() { c.Assert(reader.Close(), IsNil) }()
- content, _ := ioutil.ReadAll(reader)
+ content, _ := io.ReadAll(reader)
c.Assert(content, HasLen, 2780)
}
}
diff --git a/plumbing/object/tag_test.go b/plumbing/object/tag_test.go
index 15b943e..d374c6c 100644
--- a/plumbing/object/tag_test.go
+++ b/plumbing/object/tag_test.go
@@ -3,7 +3,6 @@ package object
import (
"fmt"
"io"
- "io/ioutil"
"strings"
"time"
@@ -466,7 +465,7 @@ func (s *TagSuite) TestEncodeWithoutSignature(c *C) {
c.Assert(err, IsNil)
er, err := encoded.Reader()
c.Assert(err, IsNil)
- payload, err := ioutil.ReadAll(er)
+ payload, err := io.ReadAll(er)
c.Assert(err, IsNil)
c.Assert(string(payload), Equals, ""+
diff --git a/plumbing/protocol/packp/sideband/demux_test.go b/plumbing/protocol/packp/sideband/demux_test.go
index 6cda703..8f23353 100644
--- a/plumbing/protocol/packp/sideband/demux_test.go
+++ b/plumbing/protocol/packp/sideband/demux_test.go
@@ -4,7 +4,6 @@ import (
"bytes"
"errors"
"io"
- "io/ioutil"
"testing"
"github.com/go-git/go-git/v5/plumbing/format/pktline"
@@ -101,7 +100,7 @@ func (s *SidebandSuite) TestDecodeWithProgress(c *C) {
c.Assert(n, Equals, 26)
c.Assert(content, DeepEquals, expected)
- progress, err := ioutil.ReadAll(output)
+ progress, err := io.ReadAll(output)
c.Assert(err, IsNil)
c.Assert(progress, DeepEquals, []byte{'F', 'O', 'O', '\n'})
}
diff --git a/plumbing/protocol/packp/updreq_decode.go b/plumbing/protocol/packp/updreq_decode.go
index 2c9843a..076de54 100644
--- a/plumbing/protocol/packp/updreq_decode.go
+++ b/plumbing/protocol/packp/updreq_decode.go
@@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/format/pktline"
@@ -81,7 +80,7 @@ func (req *ReferenceUpdateRequest) Decode(r io.Reader) error {
var ok bool
rc, ok = r.(io.ReadCloser)
if !ok {
- rc = ioutil.NopCloser(r)
+ rc = io.NopCloser(r)
}
d := &updReqDecoder{r: rc, s: pktline.NewScanner(r)}
diff --git a/plumbing/protocol/packp/updreq_decode_test.go b/plumbing/protocol/packp/updreq_decode_test.go
index 2630112..bdcbdf5 100644
--- a/plumbing/protocol/packp/updreq_decode_test.go
+++ b/plumbing/protocol/packp/updreq_decode_test.go
@@ -3,7 +3,6 @@ package packp
import (
"bytes"
"io"
- "io/ioutil"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/format/pktline"
@@ -157,7 +156,7 @@ func (s *UpdReqDecodeSuite) TestOneUpdateCommand(c *C) {
expected.Commands = []*Command{
{Name: name, Old: hash1, New: hash2},
}
- expected.Packfile = ioutil.NopCloser(bytes.NewReader([]byte{}))
+ expected.Packfile = io.NopCloser(bytes.NewReader([]byte{}))
payloads := []string{
"1ecf0ef2c2dffb796033e5a02219af86ec6584e5 2ecf0ef2c2dffb796033e5a02219af86ec6584e5 myref\x00",
@@ -177,7 +176,7 @@ func (s *UpdReqDecodeSuite) TestMultipleCommands(c *C) {
{Name: plumbing.ReferenceName("myref2"), Old: plumbing.ZeroHash, New: hash2},
{Name: plumbing.ReferenceName("myref3"), Old: hash1, New: plumbing.ZeroHash},
}
- expected.Packfile = ioutil.NopCloser(bytes.NewReader([]byte{}))
+ expected.Packfile = io.NopCloser(bytes.NewReader([]byte{}))
payloads := []string{
"1ecf0ef2c2dffb796033e5a02219af86ec6584e5 2ecf0ef2c2dffb796033e5a02219af86ec6584e5 myref1\x00",
@@ -200,7 +199,7 @@ func (s *UpdReqDecodeSuite) TestMultipleCommandsAndCapabilities(c *C) {
{Name: plumbing.ReferenceName("myref3"), Old: hash1, New: plumbing.ZeroHash},
}
expected.Capabilities.Add("shallow")
- expected.Packfile = ioutil.NopCloser(bytes.NewReader([]byte{}))
+ expected.Packfile = io.NopCloser(bytes.NewReader([]byte{}))
payloads := []string{
"1ecf0ef2c2dffb796033e5a02219af86ec6584e5 2ecf0ef2c2dffb796033e5a02219af86ec6584e5 myref1\x00shallow",
@@ -224,7 +223,7 @@ func (s *UpdReqDecodeSuite) TestMultipleCommandsAndCapabilitiesShallow(c *C) {
}
expected.Capabilities.Add("shallow")
expected.Shallow = &hash1
- expected.Packfile = ioutil.NopCloser(bytes.NewReader([]byte{}))
+ expected.Packfile = io.NopCloser(bytes.NewReader([]byte{}))
payloads := []string{
"shallow 1ecf0ef2c2dffb796033e5a02219af86ec6584e5",
@@ -247,7 +246,7 @@ func (s *UpdReqDecodeSuite) TestWithPackfile(c *C) {
{Name: name, Old: hash1, New: hash2},
}
packfileContent := []byte("PACKabc")
- expected.Packfile = ioutil.NopCloser(bytes.NewReader(packfileContent))
+ expected.Packfile = io.NopCloser(bytes.NewReader(packfileContent))
payloads := []string{
"1ecf0ef2c2dffb796033e5a02219af86ec6584e5 2ecf0ef2c2dffb796033e5a02219af86ec6584e5 myref\x00",
@@ -298,10 +297,10 @@ func (s *UpdReqDecodeSuite) testDecodeOkExpected(c *C, expected *ReferenceUpdate
}
func (s *UpdReqDecodeSuite) compareReaders(c *C, a io.ReadCloser, b io.ReadCloser) {
- pba, err := ioutil.ReadAll(a)
+ pba, err := io.ReadAll(a)
c.Assert(err, IsNil)
c.Assert(a.Close(), IsNil)
- pbb, err := ioutil.ReadAll(b)
+ pbb, err := io.ReadAll(b)
c.Assert(err, IsNil)
c.Assert(b.Close(), IsNil)
c.Assert(pba, DeepEquals, pbb)
diff --git a/plumbing/protocol/packp/updreq_encode_test.go b/plumbing/protocol/packp/updreq_encode_test.go
index 4370b79..97868bd 100644
--- a/plumbing/protocol/packp/updreq_encode_test.go
+++ b/plumbing/protocol/packp/updreq_encode_test.go
@@ -2,13 +2,12 @@ package packp
import (
"bytes"
+ "io"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/format/pktline"
"github.com/go-git/go-git/v5/plumbing/protocol/packp/capability"
- "io/ioutil"
-
. "gopkg.in/check.v1"
)
@@ -128,7 +127,7 @@ func (s *UpdReqEncodeSuite) TestWithPackfile(c *C) {
packfileContent := []byte("PACKabc")
packfileReader := bytes.NewReader(packfileContent)
- packfileReadCloser := ioutil.NopCloser(packfileReader)
+ packfileReadCloser := io.NopCloser(packfileReader)
r := NewReferenceUpdateRequest()
r.Commands = []*Command{
diff --git a/plumbing/protocol/packp/uppackresp_test.go b/plumbing/protocol/packp/uppackresp_test.go
index 3f87804..8fbf924 100644
--- a/plumbing/protocol/packp/uppackresp_test.go
+++ b/plumbing/protocol/packp/uppackresp_test.go
@@ -2,7 +2,7 @@ package packp
import (
"bytes"
- "io/ioutil"
+ "io"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/protocol/packp/capability"
@@ -21,10 +21,10 @@ func (s *UploadPackResponseSuite) TestDecodeNAK(c *C) {
res := NewUploadPackResponse(req)
defer res.Close()
- err := res.Decode(ioutil.NopCloser(bytes.NewBufferString(raw)))
+ err := res.Decode(io.NopCloser(bytes.NewBufferString(raw)))
c.Assert(err, IsNil)
- pack, err := ioutil.ReadAll(res)
+ pack, err := io.ReadAll(res)
c.Assert(err, IsNil)
c.Assert(pack, DeepEquals, []byte("PACK"))
}
@@ -38,10 +38,10 @@ func (s *UploadPackResponseSuite) TestDecodeDepth(c *C) {
res := NewUploadPackResponse(req)
defer res.Close()
- err := res.Decode(ioutil.NopCloser(bytes.NewBufferString(raw)))
+ err := res.Decode(io.NopCloser(bytes.NewBufferString(raw)))
c.Assert(err, IsNil)
- pack, err := ioutil.ReadAll(res)
+ pack, err := io.ReadAll(res)
c.Assert(err, IsNil)
c.Assert(pack, DeepEquals, []byte("PACK"))
}
@@ -55,7 +55,7 @@ func (s *UploadPackResponseSuite) TestDecodeMalformed(c *C) {
res := NewUploadPackResponse(req)
defer res.Close()
- err := res.Decode(ioutil.NopCloser(bytes.NewBufferString(raw)))
+ err := res.Decode(io.NopCloser(bytes.NewBufferString(raw)))
c.Assert(err, NotNil)
}
@@ -70,7 +70,7 @@ func (s *UploadPackResponseSuite) TestDecodeMultiACK(c *C) {
res := NewUploadPackResponse(req)
defer res.Close()
- err := res.Decode(ioutil.NopCloser(bytes.NewBuffer(nil)))
+ err := res.Decode(io.NopCloser(bytes.NewBuffer(nil)))
c.Assert(err, IsNil)
}
@@ -87,7 +87,7 @@ func (s *UploadPackResponseSuite) TestReadNoDecode(c *C) {
}
func (s *UploadPackResponseSuite) TestEncodeNAK(c *C) {
- pf := ioutil.NopCloser(bytes.NewBuffer([]byte("[PACK]")))
+ pf := io.NopCloser(bytes.NewBuffer([]byte("[PACK]")))
req := NewUploadPackRequest()
res := NewUploadPackResponseWithPackfile(req, pf)
defer func() { c.Assert(res.Close(), IsNil) }()
@@ -100,7 +100,7 @@ func (s *UploadPackResponseSuite) TestEncodeNAK(c *C) {
}
func (s *UploadPackResponseSuite) TestEncodeDepth(c *C) {
- pf := ioutil.NopCloser(bytes.NewBuffer([]byte("PACK")))
+ pf := io.NopCloser(bytes.NewBuffer([]byte("PACK")))
req := NewUploadPackRequest()
req.Depth = DepthCommits(1)
@@ -115,7 +115,7 @@ func (s *UploadPackResponseSuite) TestEncodeDepth(c *C) {
}
func (s *UploadPackResponseSuite) TestEncodeMultiACK(c *C) {
- pf := ioutil.NopCloser(bytes.NewBuffer([]byte("[PACK]")))
+ pf := io.NopCloser(bytes.NewBuffer([]byte("[PACK]")))
req := NewUploadPackRequest()
res := NewUploadPackResponseWithPackfile(req, pf)
diff --git a/plumbing/transport/file/common_test.go b/plumbing/transport/file/common_test.go
index 4d6612b..7e033a8 100644
--- a/plumbing/transport/file/common_test.go
+++ b/plumbing/transport/file/common_test.go
@@ -1,7 +1,6 @@
package file
import (
- "io/ioutil"
"os"
"os/exec"
"path/filepath"
@@ -25,7 +24,7 @@ func (s *CommonSuite) SetUpSuite(c *C) {
}
var err error
- s.tmpDir, err = ioutil.TempDir("", "")
+ s.tmpDir, err = os.MkdirTemp("", "")
c.Assert(err, IsNil)
s.ReceivePackBin = filepath.Join(s.tmpDir, "git-receive-pack")
s.UploadPackBin = filepath.Join(s.tmpDir, "git-upload-pack")
diff --git a/plumbing/transport/git/common_test.go b/plumbing/transport/git/common_test.go
index 3391aaf..7389919 100644
--- a/plumbing/transport/git/common_test.go
+++ b/plumbing/transport/git/common_test.go
@@ -2,7 +2,6 @@ package git
import (
"fmt"
- "io/ioutil"
"net"
"os"
"os/exec"
@@ -37,7 +36,7 @@ func (s *BaseSuite) SetUpTest(c *C) {
s.port, err = freePort()
c.Assert(err, IsNil)
- s.base, err = ioutil.TempDir(os.TempDir(), fmt.Sprintf("go-git-protocol-%d", s.port))
+ s.base, err = os.MkdirTemp(os.TempDir(), fmt.Sprintf("go-git-protocol-%d", s.port))
c.Assert(err, IsNil)
}
diff --git a/plumbing/transport/http/common_test.go b/plumbing/transport/http/common_test.go
index 41188e6..1517228 100644
--- a/plumbing/transport/http/common_test.go
+++ b/plumbing/transport/http/common_test.go
@@ -3,7 +3,6 @@ package http
import (
"crypto/tls"
"fmt"
- "io/ioutil"
"log"
"net"
"net/http"
@@ -222,7 +221,7 @@ func (s *BaseSuite) SetUpTest(c *C) {
l, err := net.Listen("tcp", "localhost:0")
c.Assert(err, IsNil)
- base, err := ioutil.TempDir(os.TempDir(), fmt.Sprintf("go-git-http-%d", s.port))
+ base, err := os.MkdirTemp(os.TempDir(), fmt.Sprintf("go-git-http-%d", s.port))
c.Assert(err, IsNil)
s.port = l.Addr().(*net.TCPAddr).Port
diff --git a/plumbing/transport/http/upload_pack_test.go b/plumbing/transport/http/upload_pack_test.go
index c088ecc..abb7adf 100644
--- a/plumbing/transport/http/upload_pack_test.go
+++ b/plumbing/transport/http/upload_pack_test.go
@@ -3,7 +3,7 @@ package http
import (
"context"
"fmt"
- "io/ioutil"
+ "io"
"net/url"
"os"
"path/filepath"
@@ -49,7 +49,7 @@ func (s *UploadPackSuite) TestuploadPackRequestToReader(c *C) {
sr, err := uploadPackRequestToReader(r)
c.Assert(err, IsNil)
- b, _ := ioutil.ReadAll(sr)
+ b, _ := io.ReadAll(sr)
c.Assert(string(b), Equals,
"0032want 2b41ef280fdb67a9b250678686a0c3e03b0a9989\n"+
"0032want d82f291cde9987322c8a0c81a325e1ba6159684c\n0000"+
diff --git a/plumbing/transport/internal/common/common.go b/plumbing/transport/internal/common/common.go
index b2c2fee..99e0850 100644
--- a/plumbing/transport/internal/common/common.go
+++ b/plumbing/transport/internal/common/common.go
@@ -11,7 +11,6 @@ import (
"errors"
"fmt"
"io"
- stdioutil "io/ioutil"
"strings"
"time"
@@ -156,7 +155,7 @@ func (c *client) listenFirstError(r io.Reader) chan string {
close(errLine)
}
- _, _ = io.Copy(stdioutil.Discard, r)
+ _, _ = io.Copy(io.Discard, r)
}()
return errLine
diff --git a/plumbing/transport/ssh/auth_method.go b/plumbing/transport/ssh/auth_method.go
index e89ce4b..ac4e358 100644
--- a/plumbing/transport/ssh/auth_method.go
+++ b/plumbing/transport/ssh/auth_method.go
@@ -3,7 +3,6 @@ package ssh
import (
"errors"
"fmt"
- "io/ioutil"
"os"
"os/user"
"path/filepath"
@@ -134,7 +133,7 @@ func NewPublicKeys(user string, pemBytes []byte, password string) (*PublicKeys,
// encoded private key. An encryption password should be given if the pemBytes
// contains a password encrypted PEM block otherwise password should be empty.
func NewPublicKeysFromFile(user, pemFile, password string) (*PublicKeys, error) {
- bytes, err := ioutil.ReadFile(pemFile)
+ bytes, err := os.ReadFile(pemFile)
if err != nil {
return nil, err
}
diff --git a/plumbing/transport/ssh/internal/test/proxy_test.go b/plumbing/transport/ssh/internal/test/proxy_test.go
index 8baac2b..8e775f8 100644
--- a/plumbing/transport/ssh/internal/test/proxy_test.go
+++ b/plumbing/transport/ssh/internal/test/proxy_test.go
@@ -3,7 +3,6 @@ package test
import (
"context"
"fmt"
- "io/ioutil"
"log"
"net"
"os"
@@ -59,7 +58,7 @@ func (s *ProxyEnvSuite) TestCommand(c *C) {
}()
s.port = sshListener.Addr().(*net.TCPAddr).Port
- s.base, err = ioutil.TempDir(os.TempDir(), fmt.Sprintf("go-git-ssh-%d", s.port))
+ s.base, err = os.MkdirTemp(os.TempDir(), fmt.Sprintf("go-git-ssh-%d", s.port))
c.Assert(err, IsNil)
ggssh.DefaultAuthBuilder = func(user string) (ggssh.AuthMethod, error) {
diff --git a/plumbing/transport/ssh/proxy_test.go b/plumbing/transport/ssh/proxy_test.go
index 2fab851..2ba98e8 100644
--- a/plumbing/transport/ssh/proxy_test.go
+++ b/plumbing/transport/ssh/proxy_test.go
@@ -3,7 +3,6 @@ package ssh
import (
"context"
"fmt"
- "io/ioutil"
"log"
"net"
"os"
@@ -54,7 +53,7 @@ func (s *ProxySuite) TestCommand(c *C) {
}()
s.u.port = sshListener.Addr().(*net.TCPAddr).Port
- s.u.base, err = ioutil.TempDir(os.TempDir(), fmt.Sprintf("go-git-ssh-%d", s.u.port))
+ s.u.base, err = os.MkdirTemp(os.TempDir(), fmt.Sprintf("go-git-ssh-%d", s.u.port))
c.Assert(err, IsNil)
DefaultAuthBuilder = func(user string) (AuthMethod, error) {
diff --git a/plumbing/transport/ssh/upload_pack_test.go b/plumbing/transport/ssh/upload_pack_test.go
index fafff48..67af566 100644
--- a/plumbing/transport/ssh/upload_pack_test.go
+++ b/plumbing/transport/ssh/upload_pack_test.go
@@ -3,7 +3,6 @@ package ssh
import (
"fmt"
"io"
- "io/ioutil"
"log"
"net"
"os"
@@ -43,7 +42,7 @@ func (s *UploadPackSuite) SetUpSuite(c *C) {
c.Assert(err, IsNil)
s.port = l.Addr().(*net.TCPAddr).Port
- s.base, err = ioutil.TempDir(os.TempDir(), fmt.Sprintf("go-git-ssh-%d", s.port))
+ s.base, err = os.MkdirTemp(os.TempDir(), fmt.Sprintf("go-git-ssh-%d", s.port))
c.Assert(err, IsNil)
DefaultAuthBuilder = func(user string) (AuthMethod, error) {
diff --git a/plumbing/transport/test/receive_pack.go b/plumbing/transport/test/receive_pack.go
index 018d38e..9414fba 100644
--- a/plumbing/transport/test/receive_pack.go
+++ b/plumbing/transport/test/receive_pack.go
@@ -1,13 +1,11 @@
// Package test implements common test suite for different transport
// implementations.
-//
package test
import (
"bytes"
"context"
"io"
- "io/ioutil"
"os"
"path/filepath"
@@ -235,7 +233,7 @@ func (s *ReceivePackSuite) receivePackNoCheck(c *C, ep *transport.Endpoint,
if rootPath != "" && err == nil && stat.IsDir() {
objectPath := filepath.Join(rootPath, "objects/pack")
- files, err := ioutil.ReadDir(objectPath)
+ files, err := os.ReadDir(objectPath)
c.Assert(err, IsNil)
for _, file := range files {
@@ -371,5 +369,5 @@ func (s *ReceivePackSuite) emptyPackfile() io.ReadCloser {
panic(err)
}
- return ioutil.NopCloser(&buf)
+ return io.NopCloser(&buf)
}
diff --git a/plumbing/transport/test/upload_pack.go b/plumbing/transport/test/upload_pack.go
index 3ee029d..f7842eb 100644
--- a/plumbing/transport/test/upload_pack.go
+++ b/plumbing/transport/test/upload_pack.go
@@ -1,13 +1,11 @@
// Package test implements common test suite for different transport
// implementations.
-//
package test
import (
"bytes"
"context"
"io"
- "io/ioutil"
"time"
"github.com/go-git/go-git/v5/plumbing"
@@ -154,7 +152,7 @@ func (s *UploadPackSuite) TestUploadPackWithContextOnRead(c *C) {
cancel()
- _, err = io.Copy(ioutil.Discard, reader)
+ _, err = io.Copy(io.Discard, reader)
c.Assert(err, NotNil)
err = reader.Close()
@@ -255,7 +253,7 @@ func (s *UploadPackSuite) TestFetchError(c *C) {
}
func (s *UploadPackSuite) checkObjectNumber(c *C, r io.Reader, n int) {
- b, err := ioutil.ReadAll(r)
+ b, err := io.ReadAll(r)
c.Assert(err, IsNil)
buf := bytes.NewBuffer(b)
storage := memory.NewStorage()