chore: bump minimum Go to 1.26 and adopt 1.26 features (#2920)

This commit is contained in:
Valentin Maerten
2026-08-20 12:24:04 +02:00
committed by GitHub
parent 325e3188f0
commit dd4463ec60
21 changed files with 76 additions and 73 deletions

15
task.go
View File

@@ -273,12 +273,9 @@ func (e *Executor) RunTask(ctx context.Context, call *Call) error {
e.Logger.VerboseErrf(logger.Red, "task: %q failed: %v\n", call.Task, err)
var exitCode interp.ExitStatus
var timeout *errors.TaskTimeoutError
switch {
case errors.As(err, &exitCode):
if exitCode, ok := errors.AsType[interp.ExitStatus](err); ok {
deferredExitCode = uint8(exitCode)
case errors.As(err, &timeout):
} else if _, ok := errors.AsType[*errors.TaskTimeoutError](err); ok {
deferredExitCode = errors.TimeoutExitCode
}
@@ -461,9 +458,11 @@ func (e *Executor) runCommand(ctx context.Context, t *ast.Task, call *Call, i in
// isCommandFailure reports whether the command failed on its own terms - a
// non-zero exit status or its timeout - rather than Task failing to run it.
func isCommandFailure(err error) bool {
var exitCode interp.ExitStatus
var timeout *errors.TaskTimeoutError
return errors.As(err, &exitCode) || errors.As(err, &timeout)
if _, ok := errors.AsType[interp.ExitStatus](err); ok {
return true
}
_, ok := errors.AsType[*errors.TaskTimeoutError](err)
return ok
}
// timedOut reports whether ctx was cancelled by the given timeout rather than by