aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/internal/dotgit/dotgit.go
diff options
context:
space:
mode:
authorJavi Fontan <jfontan@gmail.com>2018-03-26 23:18:54 +0200
committerJavi Fontan <jfontan@gmail.com>2018-03-27 17:32:59 +0200
commit05c414a169a75ca933402e5be19a5c4304aa4f00 (patch)
tree19dcd85c5d221cf41fa06c200423d5cc236f9f31 /storage/filesystem/internal/dotgit/dotgit.go
parent160e6d5b654fbbaf0d9264f226c56a03f0e27d30 (diff)
downloadgo-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 'storage/filesystem/internal/dotgit/dotgit.go')
-rw-r--r--storage/filesystem/internal/dotgit/dotgit.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/storage/filesystem/internal/dotgit/dotgit.go b/storage/filesystem/internal/dotgit/dotgit.go
index 027ef83..60d122f 100644
--- a/storage/filesystem/internal/dotgit/dotgit.go
+++ b/storage/filesystem/internal/dotgit/dotgit.go
@@ -375,7 +375,7 @@ func (d *DotGit) findPackedRefsInFile(f billy.File) ([]*plumbing.Reference, erro
return refs, s.Err()
}
-func (d *DotGit) findPackedRefs() ([]*plumbing.Reference, error) {
+func (d *DotGit) findPackedRefs() (r []*plumbing.Reference, error error) {
f, err := d.fs.Open(packedRefsPath)
if err != nil {
if os.IsNotExist(err) {
@@ -676,7 +676,7 @@ func (d *DotGit) PackRefs() (err error) {
// Gather all refs using addRefsFromRefDir and addRefsFromPackedRefs.
var refs []*plumbing.Reference
seen := make(map[plumbing.ReferenceName]bool)
- if err := d.addRefsFromRefDir(&refs, seen); err != nil {
+ if err = d.addRefsFromRefDir(&refs, seen); err != nil {
return err
}
if len(refs) == 0 {
@@ -684,7 +684,7 @@ func (d *DotGit) PackRefs() (err error) {
return nil
}
numLooseRefs := len(refs)
- if err := d.addRefsFromPackedRefsFile(&refs, f, seen); err != nil {
+ if err = d.addRefsFromPackedRefsFile(&refs, f, seen); err != nil {
return err
}
@@ -701,7 +701,7 @@ func (d *DotGit) PackRefs() (err error) {
w := bufio.NewWriter(tmp)
for _, ref := range refs {
- _, err := w.WriteString(ref.String() + "\n")
+ _, err = w.WriteString(ref.String() + "\n")
if err != nil {
return err
}