Repository: kopia/kopia
Pull request #3775 (2024-04-04 18:14:13)

style(general): Comment fixups for `minio_buffer_fixes`
Comment fixups for `minio_buffer_fixes` PR.

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/kopia/kopia/pull/3775?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 76.93%. Comparing base [(`cb455c6`)](https://app.codecov.io/gh/kopia/kopia/commit/cb455c699a04e54cb47e25a676d7d65063ce883e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia) to head [(`d189bea`)](https://app.codecov.io/gh/kopia/kopia/pull/3775?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia).
> Report is 85 commits behind head on master.


<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #3775      +/-   ##
==========================================
+ Coverage   75.86%   76.93%   +1.07%     
==========================================
  Files         470      476       +6     
  Lines       37301    28930    -8371     
==========================================
- Hits        28299    22258    -6041     
+ Misses       7071     4735    -2336     
- Partials     1931     1937       +6     
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/kopia/kopia/pull/3775?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kopia).


Patch:
diff --git a/go.mod b/go.mod
index 63be3c7f..63ac7d9f 100644
--- a/go.mod
+++ b/go.mod
@@ -19,7 +19,7 @@ require (
 	github.com/foomo/htpasswd v0.0.0-20200116085101-e3a90e78da9c
 	github.com/gofrs/flock v0.8.1
 	github.com/golang-jwt/jwt/v4 v4.5.0
-	github.com/google/fswalker v0.3.3-0.20231129010601-c0a7aa51805d
+	github.com/google/fswalker v0.3.3
 	github.com/google/go-cmp v0.6.0
 	github.com/google/uuid v1.6.0
 	github.com/gorilla/mux v1.8.1
diff --git a/go.sum b/go.sum
index 3cdc507e..4790e0f2 100644
--- a/go.sum
+++ b/go.sum
@@ -122,8 +122,8 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD
 github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
 github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
 github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
-github.com/google/fswalker v0.3.3-0.20231129010601-c0a7aa51805d h1:8W9T0xOCXrjV6Pw5MPNDjxtTVXP5ovN0NFgjzGjX4QU=
-github.com/google/fswalker v0.3.3-0.20231129010601-c0a7aa51805d/go.mod h1:nQzkG8g6cTUBt+VpY9f3DRlhhPwC2t+J+cU8PfDfYWc=
+github.com/google/fswalker v0.3.3 h1:K2+d6cb3vNFjquVPRObIY+QaXJ6cbleVV6yZWLzkkQ8=
+github.com/google/fswalker v0.3.3/go.mod h1:9upMSscEE8oRi0WJ0rXZZYya1DmgUtJFhXAw7KNS3c4=
 github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
 github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
 github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
diff --git a/internal/gather/gather_bytes.go b/internal/gather/gather_bytes.go
index 9b5c9f58..65b175be 100644
--- a/internal/gather/gather_bytes.go
+++ b/internal/gather/gather_bytes.go
@@ -175,10 +175,11 @@ func (b *bytesReadSeekCloser) ReadAt(bs []byte, off int64) (int, error) {
 	// move on to next and then check if all slices were consumed
 	sliceNdx++
 
+	// keep track of length of gather-buffer length in slicesN
 	slicesN := len(slices)
 
-	// while there are more bytes to read (maxBsIndex > n) and there are more
-	// slices left (sliceNdx < slicesN)
+	// while there is more room in bs (maxBsIndex > n) and there are more
+	// slices left to copy (sliceNdx < slicesN)
 	for maxBsIndex > n && sliceNdx < slicesN {
 		// get a new working slice
 		curSlice = slices[sliceNdx]


Test patch:
diff --git a/internal/gather/gather_bytes_test.go b/internal/gather/gather_bytes_test.go
index 44cabfaf..7e2cda21 100644
--- a/internal/gather/gather_bytes_test.go
+++ b/internal/gather/gather_bytes_test.go
@@ -261,8 +261,8 @@ type testCase struct {
 		inputBufferSize int
 	}
 
-	// Test some interesting input buffer sizes from a 1-byte buffer to many
-	// multiples of the internal allocator chunk size.
+	// Test some interesting input buffer sizes from a 1-byte buffer to many multiples
+	// of the internal allocator chunk size.
 	testCases := []testCase{
 		{"1", 1},
 		{"0.5x", int(0.5 * float64(defaultAllocator.chunkSize))},