diff options
author | Javi Fontan <jfontan@gmail.com> | 2018-03-26 23:18:54 +0200 |
---|---|---|
committer | Javi Fontan <jfontan@gmail.com> | 2018-03-27 17:32:59 +0200 |
commit | 05c414a169a75ca933402e5be19a5c4304aa4f00 (patch) | |
tree | 19dcd85c5d221cf41fa06c200423d5cc236f9f31 /remote.go | |
parent | 160e6d5b654fbbaf0d9264f226c56a03f0e27d30 (diff) | |
download | go-git-05c414a169a75ca933402e5be19a5c4304aa4f00.tar.gz |
*: Use CheckClose with named returns
Previously some close errors were losts. This is specially problematic
in go-git as lots of work is done here like generating indexes and
moving packfiles.
Signed-off-by: Javi Fontan <jfontan@gmail.com>
Diffstat (limited to 'remote.go')
-rw-r--r-- | remote.go | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -73,7 +73,7 @@ func (r *Remote) Push(o *PushOptions) error { // The provided Context must be non-nil. If the context expires before the // operation is complete, an error is returned. The context only affects to the // transport operations. -func (r *Remote) PushContext(ctx context.Context, o *PushOptions) error { +func (r *Remote) PushContext(ctx context.Context, o *PushOptions) (err error) { if err := o.Validate(); err != nil { return err } @@ -243,12 +243,12 @@ func (r *Remote) Fetch(o *FetchOptions) error { return r.FetchContext(context.Background(), o) } -func (r *Remote) fetch(ctx context.Context, o *FetchOptions) (storer.ReferenceStorer, error) { +func (r *Remote) fetch(ctx context.Context, o *FetchOptions) (sto storer.ReferenceStorer, err error) { if o.RemoteName == "" { o.RemoteName = r.c.Name } - if err := o.Validate(); err != nil { + if err = o.Validate(); err != nil { return nil, err } @@ -295,7 +295,7 @@ func (r *Remote) fetch(ctx context.Context, o *FetchOptions) (storer.ReferenceSt return nil, err } - if err := r.fetchPack(ctx, o, s, req); err != nil { + if err = r.fetchPack(ctx, o, s, req); err != nil { return nil, err } } @@ -354,7 +354,7 @@ func (r *Remote) fetchPack(ctx context.Context, o *FetchOptions, s transport.Upl defer ioutil.CheckClose(reader, &err) - if err := r.updateShallow(o, reader); err != nil { + if err = r.updateShallow(o, reader); err != nil { return err } @@ -872,7 +872,7 @@ func (r *Remote) buildFetchedTags(refs memory.ReferenceStorage) (updated bool, e } // List the references on the remote repository. -func (r *Remote) List(o *ListOptions) ([]*plumbing.Reference, error) { +func (r *Remote) List(o *ListOptions) (rfs []*plumbing.Reference, err error) { s, err := newUploadPackSession(r.c.URLs[0], o.Auth) if err != nil { return nil, err |