Update golangci-lint to v2.6.2

This commit is contained in:
Ciprian Hacman
2026-02-08 10:37:20 +02:00
parent b2096f7022
commit 92f2c2c4bc
15 changed files with 13 additions and 15 deletions
+3 -1
View File
@@ -17,6 +17,7 @@ limitations under the License.
package util
import (
"context"
"fmt"
"runtime"
"testing"
@@ -41,10 +42,11 @@ func TestExec(t *testing.T) {
}
}
ctx := context.TODO()
for _, v := range cmds {
args := v
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 {
t.Error("Kill(cmd) expected to have error because of empty handle, got none")
+3 -2
View File
@@ -19,18 +19,19 @@ limitations under the License.
package util
import (
"context"
"fmt"
"os/exec"
"syscall"
)
// 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
sysProcAttr := &syscall.SysProcAttr{
Setpgid: true,
}
cmd := exec.Command(name, arg...)
cmd := exec.CommandContext(ctx, name, arg...)
cmd.SysProcAttr = sysProcAttr
return cmd
}
+3 -2
View File
@@ -17,6 +17,7 @@ limitations under the License.
package util
import (
"context"
"fmt"
"os"
"os/exec"
@@ -27,7 +28,7 @@ import (
)
// 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.
name = filepath.Clean(name)
cmdArgs := arg
@@ -48,7 +49,7 @@ func Exec(name string, arg ...string) *exec.Cmd {
// Run directly.
}
return exec.Command(name, cmdArgs...)
return exec.CommandContext(ctx, name, cmdArgs...)
}
// Powershell creates a new powershell process with the specified arguments