diff --git a/plugins/out_clp_s3/internal/recovery/recovery.go b/plugins/out_clp_s3/internal/recovery/recovery.go index a46543f..9601b22 100644 --- a/plugins/out_clp_s3/internal/recovery/recovery.go +++ b/plugins/out_clp_s3/internal/recovery/recovery.go @@ -123,11 +123,10 @@ func readDirectory(dir string) (map[string]os.FileInfo, error) { } tagKey := strings.TrimSuffix(fileInfo.Name(), filepath.Ext(fileInfo.Name())) - if _, exists := files[tagKey]; !exists { - files[tagKey] = fileInfo - } else { + if _, exists := files[tagKey]; exists { return nil, fmt.Errorf("error duplicate tag %s", tagKey) } + files[tagKey] = fileInfo } return files, nil