Skip to content

Commit 06ce4cf

Browse files
committed
rebase to master and bump golangci-lint
1 parent 539e00e commit 06ce4cf

11 files changed

Lines changed: 28 additions & 19 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- name: golangci-lint
1010
uses: golangci/golangci-lint-action@v2
1111
with:
12-
version: v1.32
12+
version: v1.42
1313
args: -c .golangci.yml
1414
test:
1515
name: Test

apptest/fsOSWin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build windows
12
// +build windows
23

34
package apptest

exec/winAPI.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build windows
12
// +build windows
23

34
package exec

pkg/linuxContext.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build linux
12
// +build linux
23

34
package pkg

pkg/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ func (pm PackageTaskManager) run(
292292
)
293293

294294
res.Output = stderrBuf.String() + stdoutBuf.String()
295-
res.Pids = execCtx.Pids
295+
res.Pid = execCtx.Pid
296296

297297
return nil
298298
}

pkg/windowsContext.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build windows
12
// +build windows
23

34
package pkg

script/scriptRunner.go

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package script
33
import (
44
"context"
55
"fmt"
6+
"strings"
67
"time"
78

89
"github.com/sirupsen/logrus"
@@ -60,25 +61,26 @@ func (r Runner) Run(ctx context.Context, scripts tasks.Scripts, globalAbortOnErr
6061

6162
changeMap := make(map[string]string)
6263

63-
if !res.IsSkipped {
64-
comment = `Command "` + name + `" run`
65-
changeMap["pid"] = fmt.Sprintf("%d", res.Pid)
66-
if runErr, ok := res.Err.(exec.RunError); ok {
67-
changeMap["retcode"] = fmt.Sprintf("%d", runErr.ExitCode)
68-
}
64+
if cmdRunTask, ok := task.(*tasks.CmdRunTask); ok {
65+
if !res.IsSkipped {
66+
changeMap["pid"] = fmt.Sprintf("%d", res.Pid)
67+
if runErr, ok := res.Err.(exec.RunError); ok {
68+
changeMap["retcode"] = fmt.Sprintf("%d", runErr.ExitCode)
69+
}
6970

70-
changeMap["stderr"] = strings.TrimSpace(strings.ReplaceAll(res.StdErr, "\r\n", "\n"))
71-
changeMap["stdout"] = strings.TrimSpace(strings.ReplaceAll(res.StdOut, "\r\n", "\n"))
71+
changeMap["stderr"] = strings.TrimSpace(strings.ReplaceAll(res.StdErr, "\r\n", "\n"))
72+
changeMap["stdout"] = strings.TrimSpace(strings.ReplaceAll(res.StdOut, "\r\n", "\n"))
7273

73-
if exec.IsPowerShell(cmdRunTask.Shell) {
74-
changeMap["stdout"] = powershellUnquote(changeMap["stdout"])
74+
if exec.IsPowerShell(cmdRunTask.Shell) {
75+
changeMap["stdout"] = powershellUnquote(changeMap["stdout"])
76+
}
77+
changes++
7578
}
76-
changes++
77-
}
7879

79-
if cmdRunTask.AbortOnError && !res.Succeeded() {
80-
abort = true
81-
aborted = total - tasksRun
80+
if cmdRunTask.AbortOnError && !res.Succeeded() {
81+
abort = true
82+
aborted = total - tasksRun
83+
}
8284
}
8385

8486
if len(res.Changes) > 0 {

tasks/pkgTask.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ type PackageManagerExecutionResult struct {
153153
Output string
154154
Comment string
155155
Changes map[string]string
156-
Pids []int
156+
Pid int
157157
}
158158

159159
type PackageManager interface {
@@ -205,7 +205,7 @@ func (pte *PkgTaskExecutor) Execute(ctx context.Context, task Task) ExecutionRes
205205
execRes.StdOut = pkgExecResult.Output
206206
execRes.Comment = pkgExecResult.Comment
207207
execRes.Changes = pkgExecResult.Changes
208-
execRes.Pids = pkgExecResult.Pids
208+
execRes.Pid = pkgExecResult.Pid
209209
}
210210

211211
execRes.IsSkipped = false

utils/lineSepNix.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build windows
12
// +build windows
23

34
package utils

utils/lineSepWin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !windows
12
// +build !windows
23

34
package utils

0 commit comments

Comments
 (0)