mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-02-14 09:59:56 +00:00
Update golangci-lint to v2.6.2
This commit is contained in:
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
@@ -9,6 +9,6 @@ jobs:
|
|||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v6
|
uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: 1.24
|
go-version-file: go.mod
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
run: make lint
|
run: make lint
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -119,7 +119,7 @@ else
|
|||||||
LOGCOUNTER=*dont-include-log-counter
|
LOGCOUNTER=*dont-include-log-counter
|
||||||
endif
|
endif
|
||||||
|
|
||||||
GOLANGCI_LINT_VERSION := v2.2.0
|
GOLANGCI_LINT_VERSION := v2.6.2
|
||||||
GOLANGCI_LINT := ./.bin/golangci-lint
|
GOLANGCI_LINT := ./.bin/golangci-lint
|
||||||
|
|
||||||
lint: $(GOLANGCI_LINT)
|
lint: $(GOLANGCI_LINT)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !disable_stackdriver_exporter
|
//go:build !disable_stackdriver_exporter
|
||||||
// +build !disable_stackdriver_exporter
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2019 The Kubernetes Authors All rights reserved.
|
Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !disable_system_log_monitor
|
//go:build !disable_system_log_monitor
|
||||||
// +build !disable_system_log_monitor
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2021 The Kubernetes Authors All rights reserved.
|
Copyright 2021 The Kubernetes Authors All rights reserved.
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !disable_system_log_monitor
|
//go:build !disable_system_log_monitor
|
||||||
// +build !disable_system_log_monitor
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2021 The Kubernetes Authors All rights reserved.
|
Copyright 2021 The Kubernetes Authors All rights reserved.
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !disable_custom_plugin_monitor
|
//go:build !disable_custom_plugin_monitor
|
||||||
// +build !disable_custom_plugin_monitor
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2019 The Kubernetes Authors All rights reserved.
|
Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !disable_system_log_monitor
|
//go:build !disable_system_log_monitor
|
||||||
// +build !disable_system_log_monitor
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2019 The Kubernetes Authors All rights reserved.
|
Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !disable_system_stats_monitor
|
//go:build !disable_system_stats_monitor
|
||||||
// +build !disable_system_stats_monitor
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2019 The Kubernetes Authors All rights reserved.
|
Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ func (p *Plugin) run(rule cpmtypes.CustomRule) (exitStatus cpmtypes.Status, outp
|
|||||||
}
|
}
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
cmd := util.Exec(rule.Path, rule.Args...)
|
cmd := util.Exec(ctx, rule.Path, rule.Args...)
|
||||||
|
|
||||||
stdoutPipe, err := cmd.StdoutPipe()
|
stdoutPipe, err := cmd.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build !disable_stackdriver_exporter
|
//go:build !disable_stackdriver_exporter
|
||||||
// +build !disable_stackdriver_exporter
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2019 The Kubernetes Authors All rights reserved.
|
Copyright 2019 The Kubernetes Authors All rights reserved.
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
|
|
||||||
"k8s.io/node-problem-detector/cmd/healthchecker/options"
|
"k8s.io/node-problem-detector/cmd/healthchecker/options"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import (
|
|||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
|
|
||||||
"k8s.io/node-problem-detector/pkg/systemlogmonitor/logwatchers/types"
|
"k8s.io/node-problem-detector/pkg/systemlogmonitor/logwatchers/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
//go:build journald
|
//go:build journald
|
||||||
// +build journald
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2016 The Kubernetes Authors All rights reserved.
|
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package util
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
@@ -41,10 +42,11 @@ func TestExec(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx := context.TODO()
|
||||||
for _, v := range cmds {
|
for _, v := range cmds {
|
||||||
args := v
|
args := v
|
||||||
t.Run(fmt.Sprintf("%v", args), func(t *testing.T) {
|
t.Run(fmt.Sprintf("%v", args), func(t *testing.T) {
|
||||||
cmd := Exec(args[0], args[1:]...)
|
cmd := Exec(ctx, args[0], args[1:]...)
|
||||||
|
|
||||||
if err := Kill(cmd); err == nil {
|
if err := Kill(cmd); err == nil {
|
||||||
t.Error("Kill(cmd) expected to have error because of empty handle, got none")
|
t.Error("Kill(cmd) expected to have error because of empty handle, got none")
|
||||||
|
|||||||
@@ -19,18 +19,19 @@ limitations under the License.
|
|||||||
package util
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Exec creates a new process with the specified arguments.
|
// Exec creates a new process with the specified arguments.
|
||||||
func Exec(name string, arg ...string) *exec.Cmd {
|
func Exec(ctx context.Context, name string, arg ...string) *exec.Cmd {
|
||||||
// create a process group
|
// create a process group
|
||||||
sysProcAttr := &syscall.SysProcAttr{
|
sysProcAttr := &syscall.SysProcAttr{
|
||||||
Setpgid: true,
|
Setpgid: true,
|
||||||
}
|
}
|
||||||
cmd := exec.Command(name, arg...)
|
cmd := exec.CommandContext(ctx, name, arg...)
|
||||||
cmd.SysProcAttr = sysProcAttr
|
cmd.SysProcAttr = sysProcAttr
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package util
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@@ -27,7 +28,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Exec creates a new process with the specified arguments.
|
// Exec creates a new process with the specified arguments.
|
||||||
func Exec(name string, arg ...string) *exec.Cmd {
|
func Exec(ctx context.Context, name string, arg ...string) *exec.Cmd {
|
||||||
// Windows does not handle relative path names in exec very well.
|
// Windows does not handle relative path names in exec very well.
|
||||||
name = filepath.Clean(name)
|
name = filepath.Clean(name)
|
||||||
cmdArgs := arg
|
cmdArgs := arg
|
||||||
@@ -48,7 +49,7 @@ func Exec(name string, arg ...string) *exec.Cmd {
|
|||||||
// Run directly.
|
// Run directly.
|
||||||
}
|
}
|
||||||
|
|
||||||
return exec.Command(name, cmdArgs...)
|
return exec.CommandContext(ctx, name, cmdArgs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Powershell creates a new powershell process with the specified arguments
|
// Powershell creates a new powershell process with the specified arguments
|
||||||
|
|||||||
Reference in New Issue
Block a user