-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Log Errors Missing in Internal #3016
Conversation
@@ -159,7 +159,7 @@ func (i *Informer) Run(stopCh chan struct{}) { | |||
i.Secret.HasSynced, | |||
i.ConfigMap.HasSynced, | |||
) { | |||
runtime.HandleError(fmt.Errorf("Timed out waiting for caches to sync")) | |||
runtime.HandleError(fmt.Errorf("timed out waiting for caches to sync")) |
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.
The capital letter is by design here. See logError
@@ -173,7 +173,7 @@ func (i *Informer) Run(stopCh chan struct{}) { | |||
if !cache.WaitForCacheSync(stopCh, | |||
i.Ingress.HasSynced, | |||
) { | |||
runtime.HandleError(fmt.Errorf("Timed out waiting for caches to sync")) | |||
runtime.HandleError(fmt.Errorf("timed out waiting for caches to sync")) |
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.
The capital letter is by design here. See logError
internal/file/file.go
Outdated
@@ -27,6 +28,7 @@ func SHA1(filename string) string { | |||
hasher := sha1.New() | |||
s, err := ioutil.ReadFile(filename) | |||
if err != nil { | |||
glog.Errorf("error reading file %v", 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.
Should start with a capital letter.
@antoineco reverted the logs back to capital. |
Codecov Report
@@ Coverage Diff @@
## master #3016 +/- ##
=========================================
+ Coverage 47.5% 47.5% +<.01%
=========================================
Files 77 77
Lines 5644 5646 +2
=========================================
+ Hits 2681 2682 +1
- Misses 2609 2611 +2
+ Partials 354 353 -1
Continue to review full report at Codecov.
|
All of them? Only 2 of them had the wrong format. |
@antoineco resolved the issue: I should have read https://github.com/golang/go/wiki/CodeReviewComments#error-strings |
I did not even know this convention was documented :) Something learned! |
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.
Apart from this last comment of mine, LGTM
internal/k8s/main.go
Outdated
@@ -42,6 +42,7 @@ func ParseNameNS(input string) (string, string, error) { | |||
func GetNodeIPOrName(kubeClient clientset.Interface, name string, useInternalIP bool) string { | |||
node, err := kubeClient.CoreV1().Nodes().Get(name, metav1.GetOptions{}) | |||
if err != nil { | |||
glog.Error(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.
I'd prepend some context like you did in internal/file/file.go
. Eg. "Error getting node %s: %s" , name, 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.
Thanks will do!
/lgtm |
/lgtm |
Adds a few missing errors and fix formatting for others. Fixes kubernetes#3013
/lgtm |
@diazjf thanks! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aledbf, antoineco, diazjf The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Adds a few missing errors and cleans some of the error log convention.
Fixes #3013