-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix remaining linter warnings #766
Conversation
c288364
to
d71bae5
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #766 +/- ##
=========================================
+ Coverage 0 16.84% +16.84%
=========================================
Files 0 88 +88
Lines 0 17896 +17896
=========================================
+ Hits 0 3014 +3014
- Misses 0 14638 +14638
- Partials 0 244 +244
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
cfff9be
to
b6fe103
Compare
Signed-off-by: Benny Zlotnik <[email protected]>
b6fe103
to
dc7cb7c
Compare
Quality Gate passedIssues Measures |
|
||
metrics.StartPrometheusEndpoint("8443", "", certsDirectory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you change the port to 8443 on purpose?
@@ -490,7 +489,7 @@ func getResourceCapacity(capacity int64, units string) (int64, error) { | |||
for i := range items { | |||
item := strings.TrimSpace(items[i]) | |||
if i == 0 && len(item) > 0 && item != "byte" { | |||
return 0, errors.New(fmt.Sprintf("units '%s' are invalid, only 'byte' is supported", units)) | |||
return 0, fmt.Errorf(fmt.Sprintf("units '%s' are invalid, only 'byte' is supported", units)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return 0, fmt.Errorf(fmt.Sprintf("units '%s' are invalid, only 'byte' is supported", units)) | |
return 0, fmt.Errorf("units '%s' are invalid, only 'byte' is supported", units) |
@@ -502,15 +501,15 @@ func getResourceCapacity(capacity int64, units string) (int64, error) { | |||
} | |||
nums := strings.Split(item, "^") | |||
if len(nums) != 2 { | |||
return 0, errors.New(fmt.Sprintf("units '%s' are invalid, item is invalid: %s", units, item)) | |||
return 0, fmt.Errorf(fmt.Sprintf("units '%s' are invalid, item is invalid: %s", units, item)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return 0, fmt.Errorf(fmt.Sprintf("units '%s' are invalid, item is invalid: %s", units, item)) | |
return 0, fmt.Errorf("units '%s' are invalid, item is invalid: %s", units, item) |
} | ||
base, err := strconv.Atoi(nums[0]) | ||
if err != nil { | ||
return 0, errors.New(fmt.Sprintf("units '%s' are invalid, base component is invalid: %s", units, item)) | ||
return 0, fmt.Errorf(fmt.Sprintf("units '%s' are invalid, base component is invalid: %s", units, item)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return 0, fmt.Errorf(fmt.Sprintf("units '%s' are invalid, base component is invalid: %s", units, item)) | |
return 0, fmt.Errorf("units '%s' are invalid, base component is invalid: %s", units, item) |
} | ||
pow, err := strconv.Atoi(nums[1]) | ||
if err != nil { | ||
return 0, errors.New(fmt.Sprintf("units '%s' are invalid, pow component is invalid: %s", units, item)) | ||
return 0, fmt.Errorf(fmt.Sprintf("units '%s' are invalid, pow component is invalid: %s", units, item)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return 0, fmt.Errorf(fmt.Sprintf("units '%s' are invalid, pow component is invalid: %s", units, item)) | |
return 0, fmt.Errorf("units '%s' are invalid, pow component is invalid: %s", units, item) |
err = tx.End() | ||
if err != nil { | ||
err = liberr.Wrap(err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it really recommended to set the error that within a go-routine?...
@@ -356,7 +356,15 @@ func (r *Collector) getUpdates(ctx context.Context) error { | |||
if err != nil { | |||
return liberr.Wrap(err) | |||
} | |||
defer pc.Destroy(context.Background()) | |||
defer func() { | |||
err = pc.Destroy(context.Background()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question here - wouldn't it make sense to use a new variable?
go r.manager.Start(ctx) | ||
|
||
go func() { | ||
err = r.manager.Start(ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here?
@@ -1032,14 +1032,14 @@ func TestWatch(t *testing.T) { | |||
for i := 0; i < N; i++ { | |||
switch action { | |||
case Created: | |||
created = append( | |||
_ = append( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we drop the _ =
part?
created, | ||
TestEvent{ | ||
action: action, | ||
model: &TestObject{ID: i}, | ||
}) | ||
case Updated: | ||
updated = append( | ||
_ = append( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here?
No description provided.