feat(ci): fix linter complaints

This commit is contained in:
Simon Cornet 2025-07-07 22:23:31 +02:00
commit 5180599583
2 changed files with 11 additions and 4 deletions

View file

@ -274,13 +274,16 @@ func handleResult(result GitOperationResult, stats *GitStats) {
logger.Print("Successfully pulled: "+result.RepoName, nil)
case "error":
if result.ErrorType == "unstaged" {
switch result.ErrorType {
case "unstaged":
stats.IncrementCounter("unstaged", result.RepoName)
logger.Print("Found unstaged changes in: "+result.RepoName, nil)
} else if result.ErrorType == "uncommitted" {
case "uncommitted":
stats.IncrementCounter("uncommitted", result.RepoName)
logger.Print("Found uncommitted changes in: "+result.RepoName, nil)
} else {
default:
stats.IncrementCounter("error", "")
logger.Print("ERROR processing "+result.RepoName+": "+result.Error.Error(), nil)
}

View file

@ -213,7 +213,11 @@ func (c *GiteaClient) ValidateConnection(ctx context.Context) error {
if err != nil {
return fmt.Errorf("making validation request: %w", err)
}
defer resp.Body.Close()
defer func() {
if err := resp.Body.Close(); err != nil {
logger.Print("failed to close response body: %v", err)
}
}()
if resp.StatusCode == http.StatusUnauthorized {
return fmt.Errorf("invalid or expired token")