-
Notifications
You must be signed in to change notification settings - Fork 28
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 gocritic
findings
#292
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,6 @@ linters: | |
- gosec | ||
- revive | ||
- misspell | ||
- gocritic | ||
disable: | ||
- errcheck |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,8 +107,7 @@ func (f *Follower) Log(msg string) { | |
// tailLogs start tailing logs for each container name in init-containers and containers, if not | ||
// started already. | ||
func (f *Follower) tailLogs(pod *corev1.Pod) { | ||
containers := append(pod.Spec.InitContainers, pod.Spec.Containers...) | ||
for _, container := range containers { | ||
for _, container := range append(pod.Spec.InitContainers, pod.Spec.Containers...) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if _, exists := f.tailLogsStarted[container.Name]; exists { | ||
continue | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,8 +94,6 @@ func (p *PodWatcher) WithNoPodEventsYetFn(fn NoPodEventsYetFn) *PodWatcher { | |
|
||
// handleEvent applies user informed functions against informed pod and event. | ||
func (p *PodWatcher) handleEvent(pod *corev1.Pod, event watch.Event) error { | ||
//p.stopLock.Lock() | ||
//defer p.stopLock.Unlock() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably unused by now. |
||
p.eventTicker.Stop() | ||
switch event.Type { | ||
case watch.Added: | ||
|
@@ -235,6 +233,6 @@ func NewPodWatcher( | |
clientset kubernetes.Interface, | ||
ns string, | ||
) (*PodWatcher, error) { | ||
//TODO don't think the have not received events yet ticker needs to be tunable, but leaving a TODO for now while we get feedback | ||
// TODO don't think the have not received events yet ticker needs to be tunable, but leaving a TODO for now while we get feedback | ||
return &PodWatcher{ctx: ctx, to: timeout, ns: ns, clientset: clientset, eventTicker: time.NewTicker(1 * time.Second), stopCh: make(chan bool), stopLock: sync.Mutex{}}, nil | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ func (wc *writeCounter) Write(p []byte) (int, error) { | |
} | ||
|
||
func trimPrefix(prefix, fpath string) string { | ||
return strings.TrimPrefix(strings.Replace(fpath, prefix, "", -1), string(filepath.Separator)) | ||
return strings.TrimPrefix(strings.ReplaceAll(fpath, prefix, ""), string(filepath.Separator)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
func writeFileToTar(tw *tar.Writer, src, fpath string, stat fs.FileInfo) error { | ||
|
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.
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.
never saw such range with append on the same line, nice.