aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/format')
-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
11 files changed, 22 insertions, 28 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