Skip to content

Commit

Permalink
Refactor variable name from len to length (#1675)
Browse files Browse the repository at this point in the history
I have made some changes to the code in this pull request. The main
change is that I have renamed the variable `len` to `length`. This is
because `len` is a built-in function in Go, and using it as a variable
name can cause confusion and potential issues down the line. It is best
practice to use a different name, and `length` is a clear and
descriptive alternative.
  • Loading branch information
Chirag018 committed May 1, 2023
1 parent 318d785 commit a0f1b97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/shares/share_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ func TestShareBuilderWriteSequenceLen(t *testing.T) {
share, err := tc.builder.Build()
require.NoError(t, err)

len, err := share.SequenceLen()
length, err := share.SequenceLen()
require.NoError(t, err)

assert.Equal(t, tc.wantLen, len)
assert.Equal(t, tc.wantLen, length)
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/shares/shares_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ func TestSequenceLen(t *testing.T) {

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
len, err := tc.share.SequenceLen()
length, err := tc.share.SequenceLen()

if tc.wantErr {
assert.Error(t, err)
return
}
if tc.wantLen != len {
t.Errorf("want %d, got %d", tc.wantLen, len)
if tc.wantLen != length {
t.Errorf("want %d, got %d", tc.wantLen, length)
}
})
}
Expand Down

0 comments on commit a0f1b97

Please sign in to comment.