From a82eed6cd71a2f82dc66312cf789c65c288d3877 Mon Sep 17 00:00:00 2001 From: Victor Skvortsov Date: Thu, 30 Oct 2025 14:03:55 +0500 Subject: [PATCH] Fix Go err race --- runner/cmd/runner/main.go | 6 +++--- runner/internal/executor/executor.go | 4 ++-- runner/internal/shim/host_info.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/runner/cmd/runner/main.go b/runner/cmd/runner/main.go index 4b37a086ad..001e805373 100644 --- a/runner/cmd/runner/main.go +++ b/runner/cmd/runner/main.go @@ -28,9 +28,9 @@ func start(tempDir string, homeDir string, httpPort int, sshPort int, logLevel i return fmt.Errorf("create default log file: %w", err) } defer func() { - err = defaultLogFile.Close() - if err != nil { - log.Error(context.TODO(), "Failed to close default log file", "err", err) + closeErr := defaultLogFile.Close() + if closeErr != nil { + log.Error(context.TODO(), "Failed to close default log file", "err", closeErr) } }() diff --git a/runner/internal/executor/executor.go b/runner/internal/executor/executor.go index 9901b32a6e..4c79429602 100644 --- a/runner/internal/executor/executor.go +++ b/runner/internal/executor/executor.go @@ -422,8 +422,8 @@ func (ex *RunExecutor) execJob(ctx context.Context, jobLogFile io.Writer) error cmd := exec.CommandContext(ctx, ex.jobSpec.Commands[0], ex.jobSpec.Commands[1:]...) cmd.Cancel = func() error { // returns error on Windows - if err = cmd.Process.Signal(os.Interrupt); err != nil { - return fmt.Errorf("send interrupt signal: %w", err) + if signalErr := cmd.Process.Signal(os.Interrupt); signalErr != nil { + return fmt.Errorf("send interrupt signal: %w", signalErr) } return nil } diff --git a/runner/internal/shim/host_info.go b/runner/internal/shim/host_info.go index f7df215082..ea717e112c 100644 --- a/runner/internal/shim/host_info.go +++ b/runner/internal/shim/host_info.go @@ -24,7 +24,7 @@ type hostInfo struct { func WriteHostInfo(dir string, resources Resources) error { path := filepath.Join(dir, "host_info.json") // if host_info.json already exists, do nothing and return os.ErrExist - if _, err := os.Stat(path); errors.Is(err, os.ErrExist) { + if _, err := os.Stat(path); !errors.Is(err, os.ErrNotExist) { return err }