Skip to content

Commit 85cd43e

Browse files
committed
fix: avoid shadowing of 'err' in version parsing for plugin and config packages
Renamed inner error variables in version parsing logic in pkg/plugin/version.go and pkg/config/version.go from 'err' to 'errParse' to avoid shadowing the outer 'err' variable. This improves clarity in control flow and prevents potential confusion in error handling.
1 parent e3658a6 commit 85cd43e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pkg/config/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (v *Version) Parse(version string) error {
5151
var err error
5252
if v.Number, err = strconv.Atoi(substrings[0]); err != nil {
5353
// Let's check if the `-` belonged to a negative number
54-
if n, err := strconv.Atoi(version); err == nil && n < 0 {
54+
if n, errParse := strconv.Atoi(version); errParse == nil && n < 0 {
5555
return errNonPositive
5656
}
5757
return err

pkg/plugin/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (v *Version) Parse(version string) error {
5151
var err error
5252
if v.Number, err = strconv.Atoi(substrings[0]); err != nil {
5353
// Let's check if the `-` belonged to a negative number
54-
if n, err := strconv.Atoi(version); err == nil && n < 0 {
54+
if n, errParse := strconv.Atoi(version); errParse == nil && n < 0 {
5555
return errNegative
5656
}
5757
return err

0 commit comments

Comments
 (0)