aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Gomes <pjbgf@linux.com>2024-06-28 23:10:23 +0100
committerPaulo Gomes <pjbgf@linux.com>2024-06-29 00:09:34 +0100
commitf61638f24a924c48606977e38920eac07c7251e2 (patch)
treed2b4a3d38a688921a46392b6b8151190bbb216c7
parent1e72372fced2c3b5300f1408e6e71b1a50adc6e3 (diff)
downloadgo-git-f61638f24a924c48606977e38920eac07c7251e2.tar.gz
*: Small fixes to remove linter warnings
Signed-off-by: Paulo Gomes <pjbgf@linux.com>
-rw-r--r--plumbing/format/index/decoder.go1
-rw-r--r--repository.go2
-rw-r--r--storage/filesystem/dotgit/dotgit_test.go4
-rw-r--r--worktree_linux.go3
-rw-r--r--worktree_status.go4
5 files changed, 7 insertions, 7 deletions
diff --git a/plumbing/format/index/decoder.go b/plumbing/format/index/decoder.go
index f43b1c5..fc25d37 100644
--- a/plumbing/format/index/decoder.go
+++ b/plumbing/format/index/decoder.go
@@ -225,7 +225,6 @@ func (d *Decoder) readExtensions(idx *Index) error {
peeked, err = d.buf.Peek(peekLen)
if len(peeked) < peekLen {
// there can't be an extension at this point, so let's bail out
- err = nil
break
}
if err != nil {
diff --git a/repository.go b/repository.go
index a57c714..6d7e196 100644
--- a/repository.go
+++ b/repository.go
@@ -1037,7 +1037,7 @@ func (r *Repository) setIsBare(isBare bool) error {
return r.Storer.SetConfig(cfg)
}
-func (r *Repository) updateRemoteConfigIfNeeded(o *CloneOptions, c *config.RemoteConfig, head *plumbing.Reference) error {
+func (r *Repository) updateRemoteConfigIfNeeded(o *CloneOptions, c *config.RemoteConfig, _ *plumbing.Reference) error {
if !o.SingleBranch {
return nil
}
diff --git a/storage/filesystem/dotgit/dotgit_test.go b/storage/filesystem/dotgit/dotgit_test.go
index c224397..8a5d8dd 100644
--- a/storage/filesystem/dotgit/dotgit_test.go
+++ b/storage/filesystem/dotgit/dotgit_test.go
@@ -611,7 +611,7 @@ func (s *SuiteDotGit) TestObjectsExclusive(c *C) {
testObjectsWithPrefix(c, fs, dir)
}
-func testObjects(c *C, fs billy.Filesystem, dir *DotGit) {
+func testObjects(c *C, _ billy.Filesystem, dir *DotGit) {
hashes, err := dir.Objects()
c.Assert(err, IsNil)
c.Assert(hashes, HasLen, 187)
@@ -620,7 +620,7 @@ func testObjects(c *C, fs billy.Filesystem, dir *DotGit) {
c.Assert(hashes[2].String(), Equals, "03db8e1fbe133a480f2867aac478fd866686d69e")
}
-func testObjectsWithPrefix(c *C, fs billy.Filesystem, dir *DotGit) {
+func testObjectsWithPrefix(c *C, _ billy.Filesystem, dir *DotGit) {
prefix, _ := hex.DecodeString("01d5")
hashes, err := dir.ObjectsWithPrefix(prefix)
c.Assert(err, IsNil)
diff --git a/worktree_linux.go b/worktree_linux.go
index 6fcace2..f6b85fe 100644
--- a/worktree_linux.go
+++ b/worktree_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
package git
@@ -21,6 +22,6 @@ func init() {
}
}
-func isSymlinkWindowsNonAdmin(err error) bool {
+func isSymlinkWindowsNonAdmin(_ error) bool {
return false
}
diff --git a/worktree_status.go b/worktree_status.go
index dd9b243..10b9d94 100644
--- a/worktree_status.go
+++ b/worktree_status.go
@@ -488,7 +488,7 @@ func (w *Worktree) copyFileToStorage(path string) (hash plumbing.Hash, err error
return w.r.Storer.SetEncodedObject(obj)
}
-func (w *Worktree) fillEncodedObjectFromFile(dst io.Writer, path string, fi os.FileInfo) (err error) {
+func (w *Worktree) fillEncodedObjectFromFile(dst io.Writer, path string, _ os.FileInfo) (err error) {
src, err := w.Filesystem.Open(path)
if err != nil {
return err
@@ -503,7 +503,7 @@ func (w *Worktree) fillEncodedObjectFromFile(dst io.Writer, path string, fi os.F
return err
}
-func (w *Worktree) fillEncodedObjectFromSymlink(dst io.Writer, path string, fi os.FileInfo) error {
+func (w *Worktree) fillEncodedObjectFromSymlink(dst io.Writer, path string, _ os.FileInfo) error {
target, err := w.Filesystem.Readlink(path)
if err != nil {
return err