Enable golangci linter forcetypeassert (#3168)

Split out from https://github.com/woodpecker-ci/woodpecker/pull/2960
This commit is contained in:
Robert Kaussow
2024-01-12 02:01:02 +01:00
committed by GitHub
parent f813badcf9
commit 9bbba4441d
13 changed files with 81 additions and 39 deletions

View File

@@ -216,7 +216,12 @@ func (e *kube) WaitStep(ctx context.Context, step *types.Step, taskUUID string)
finished := make(chan bool)
podUpdated := func(old, new any) {
pod := new.(*v1.Pod)
pod, ok := new.(*v1.Pod)
if !ok {
log.Error().Msgf("could not parse pod: %v", new)
return
}
if pod.Name == podName {
if isImagePullBackOffState(pod) {
finished <- true
@@ -276,7 +281,12 @@ func (e *kube) TailStep(ctx context.Context, step *types.Step, taskUUID string)
up := make(chan bool)
podUpdated := func(old, new any) {
pod := new.(*v1.Pod)
pod, ok := new.(*v1.Pod)
if !ok {
log.Error().Msgf("could not parse pod: %v", new)
return
}
if pod.Name == podName {
switch pod.Status.Phase {
case v1.PodRunning, v1.PodSucceeded, v1.PodFailed: