Skip to content
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 deprecated, missing error and type cast lint checks #413

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

TheSpiritXIII
Copy link
Member

This fixes all lints warnings in the operator package and a few in other packages.

Copy link
Collaborator

@pintohutch pintohutch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, we have a make target make lint that runs the default golangci-lint checkers.

I don't think your changes here resolve 100% everything there, but if you want to add linting to the Github workflows, that could also be something we enforce continually.

@@ -371,12 +371,6 @@ func (r *collectionReconciler) makeCollectorConfig(ctx context.Context, spec *mo
cfgs, err := pmon.ScrapeConfigs(projectID, location, cluster)
if err != nil {
msg := "generating scrape config failed for PodMonitoring endpoint"
cond = &monitoringv1.MonitoringCondition{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think this is a bug. We never update the status on a bad config.

Can you add a TODO to fix with your deletion?

// TODO: surface ScrapeConfigError to PodMonitoring status here.

@@ -410,12 +404,6 @@ func (r *collectionReconciler) makeCollectorConfig(ctx context.Context, spec *mo
cfgs, err := cmon.ScrapeConfigs(projectID, location, cluster)
if err != nil {
msg := "generating scrape config failed for PodMonitoring endpoint"
cond = &monitoringv1.MonitoringCondition{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this, this should be surfaced to users instead of nacked.

@@ -256,23 +262,20 @@ func (tctx *testContext) createBaseResources(ctx context.Context) ([]metav1.Owne
if err != nil {
return nil, errors.Wrap(err, "deserializing alertmanager manifest")
}
switch obj.(type) {
switch obj := obj.(type) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice.

var podMonitorings monitoringv1.PodMonitoringList
kubeClient.List(ctx, &podMonitorings)
if err := kubeClient.List(ctx, &podMonitorings); err != nil {
return false, nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: By returning nil here, we're effectively nacking any errors when doing the list. Is that the desired behavior? Or should we error and exit immediately in the test?

@TheSpiritXIII TheSpiritXIII marked this pull request as draft December 7, 2023 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants