This commit is contained in:
Stephan D
2026-03-10 12:31:09 +01:00
parent d87e709f43
commit e77d1ab793
287 changed files with 2089 additions and 1550 deletions

View File

@@ -15,6 +15,7 @@ func CloseFile(logger mlogger.Logger, file *os.File) {
}
func ReadFile(logger mlogger.Logger, filePath string) ([]byte, error) {
//nolint:gosec // Read path is provided by trusted caller configuration.
file, err := os.Open(filePath)
if err != nil {
logger.Warn("Failed to open file", zap.String("path", filePath), zap.Error(err))

View File

@@ -49,7 +49,11 @@ func SendAPIRequest(ctx context.Context, logger mlogger.Logger, httpMethod api.H
logger.Warn("Failed to execute request", zap.Error(err), zap.String("method", method), zap.String("url", url), zap.Any("payload", payload))
return err
}
defer resp.Body.Close()
defer func() {
if closeErr := resp.Body.Close(); closeErr != nil {
logger.Warn("Failed to close response body", zap.Error(closeErr), zap.String("method", method), zap.String("url", url))
}
}()
// Read the sresponse body
body, err := io.ReadAll(resp.Body)

View File

@@ -9,7 +9,7 @@ import (
// Returns the reordered slice with updated indices, or an error if indices are invalid
func IndexableRefs(items []model.IndexableRef, oldIndex, newIndex int) ([]model.IndexableRef, error) {
// Find the item to reorder
var targetIndex int = -1
targetIndex := -1
for i, item := range items {
if item.Index == oldIndex {
targetIndex = i