Commit 961cb31
authored
refactor: Use built-in clear to zero byte slice (#2566)
<!--
Please read and fill out this form before submitting your PR.
Please make sure you have reviewed our contributors guide before
submitting your
first PR.
NOTE: PR titles should follow semantic commits:
https://www.conventionalcommits.org/en/v1.0.0/
-->
## Overview
<!--
Please provide an explanation of the PR, including the appropriate
context,
background, goal, and rationale. If there is an issue with this
information,
please provide a tl;dr and link the issue.
Ex: Closes #<issue number>
-->
Replace the manual for-loop with a call to the built-in clear function
to set all elements of the slice to their zero value. This change
improves code readability and makes the intent more explicit.
This is the idiomatic approach for this operation since Go 1.21.
Signed-off-by: alex9long <alex9long@outlook.com>1 parent 42313a1 commit 961cb31
1 file changed
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
439 | | - | |
440 | | - | |
441 | | - | |
| 439 | + | |
442 | 440 | | |
443 | 441 | | |
444 | 442 | | |
| |||
0 commit comments