mirror of
https://gitea.com/gitea/runner.git
synced 2026-08-28 14:57:46 +00:00
chore: update deps, adapt lint, use json v2 (#1185)
- Raised go to 1.27 - Adopted json v2 - Sync lint config from gitea - Fixed all issues Co-authored-by: silverwind <me@silverwind.io> Reviewed-on: https://gitea.com/gitea/runner/pulls/1185 Reviewed-by: bircni <bircni@icloud.com> Co-authored-by: Renovate Bot <renovate-bot@gitea.com>
This commit is contained in:
@@ -87,8 +87,7 @@ func executeHealthCheck(ctx context.Context, script string, timeout time.Duratio
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
var exitErr *exec.ExitError
|
||||
if errors.As(err, &exitErr) {
|
||||
if exitErr, ok := errors.AsType[*exec.ExitError](err); ok {
|
||||
return fmt.Errorf("exited with code %d", exitErr.ExitCode())
|
||||
}
|
||||
return err
|
||||
|
||||
@@ -74,8 +74,7 @@ func (r *Runner) runPostTaskScript(ctx context.Context, reporter *report.Reporte
|
||||
log.Warnf("post-task script %q for task %d: %v", script, task.Id, err)
|
||||
return
|
||||
}
|
||||
var exitErr *exec.ExitError
|
||||
if errors.As(err, &exitErr) {
|
||||
if exitErr, ok := errors.AsType[*exec.ExitError](err); ok {
|
||||
log.Warnf("post-task script %q for task %d exited with code %d", script, task.Id, exitErr.ExitCode())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package run
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
@@ -676,7 +676,7 @@ func postInternalCache(url, secret string, body map[string]any) (map[string]any,
|
||||
}
|
||||
answer := map[string]any{}
|
||||
// A server too old to answer with a body is not an error, it simply tells us nothing.
|
||||
_ = json.NewDecoder(resp.Body).Decode(&answer)
|
||||
_ = json.UnmarshalRead(resp.Body, &answer)
|
||||
return answer, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ package run
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"encoding/json/v2"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@@ -152,7 +152,7 @@ func TestRunner_CacheFullFlow_MatchesToolkit(t *testing.T) {
|
||||
|
||||
func decodeJSON(resp *http.Response, v any) error {
|
||||
defer resp.Body.Close()
|
||||
return json.NewDecoder(resp.Body).Decode(v)
|
||||
return json.UnmarshalRead(resp.Body, v)
|
||||
}
|
||||
|
||||
// End-to-end against a remote cache-server: token unknown → 401, register →
|
||||
|
||||
Reference in New Issue
Block a user