From 250ba298a9ec93ab3c62a8aa60834cc1889f65ac Mon Sep 17 00:00:00 2001 From: "Santiago M. Mola" Date: Wed, 26 Apr 2017 13:30:03 +0200 Subject: format/packfile: rename Seek to SeekFromStart This has signature and behavior distinct from io.Seeker, go vet complains about this, so we change it to a different name to avoid confusion. --- plumbing/format/packfile/decoder.go | 4 ++-- plumbing/format/packfile/scanner.go | 5 +++-- plumbing/format/packfile/scanner_test.go | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'plumbing/format/packfile') diff --git a/plumbing/format/packfile/decoder.go b/plumbing/format/packfile/decoder.go index f3328ef..21ddbbf 100644 --- a/plumbing/format/packfile/decoder.go +++ b/plumbing/format/packfile/decoder.go @@ -310,13 +310,13 @@ func (d *Decoder) DecodeObjectAt(offset int64) (plumbing.EncodedObject, error) { return nil, ErrNonSeekable } - beforeJump, err := d.s.Seek(offset) + beforeJump, err := d.s.SeekFromStart(offset) if err != nil { return nil, err } defer func() { - _, seekErr := d.s.Seek(beforeJump) + _, seekErr := d.s.SeekFromStart(beforeJump) if err == nil { err = seekErr } diff --git a/plumbing/format/packfile/scanner.go b/plumbing/format/packfile/scanner.go index d8cece6..97512d1 100644 --- a/plumbing/format/packfile/scanner.go +++ b/plumbing/format/packfile/scanner.go @@ -300,8 +300,9 @@ func (s *Scanner) copyObject(w io.Writer) (int64, error) { return io.Copy(w, s.zr) } -// Seek sets a new offset from start, returns the old position before the change -func (s *Scanner) Seek(offset int64) (previous int64, err error) { +// SeekFromStart sets a new offset from start, returns the old position before +// the change. +func (s *Scanner) SeekFromStart(offset int64) (previous int64, err error) { // if seeking we assume that you are not interested on the header if s.version == 0 { s.version = VersionSupported diff --git a/plumbing/format/packfile/scanner_test.go b/plumbing/format/packfile/scanner_test.go index f2aa5fb..1ca8b6e 100644 --- a/plumbing/format/packfile/scanner_test.go +++ b/plumbing/format/packfile/scanner_test.go @@ -4,9 +4,10 @@ import ( "bytes" "io" - . "gopkg.in/check.v1" - "github.com/src-d/go-git-fixtures" "gopkg.in/src-d/go-git.v4/plumbing" + + "github.com/src-d/go-git-fixtures" + . "gopkg.in/check.v1" ) type ScannerSuite struct { -- cgit