File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -36,25 +36,33 @@ func init() {
36
36
}
37
37
38
38
func runMultiGroup (pattern string , fn func (string )) error {
39
+ var groups []string
40
+
39
41
re , err := regexp .Compile (pattern )
40
42
if err != nil {
41
43
return fmt .Errorf ("invalid <log group> pattern: %s" , err )
42
44
}
43
45
44
46
b := blade .NewBlade (& config.Configuration {}, & awsConfig , nil )
45
-
46
- var wg sync.WaitGroup
47
- for _ , group := range b .GetLogGroups () {
48
- name := group .LogGroupName
49
- if name == nil || ! re .MatchString (* name ) {
47
+ for _ , g := range b .GetLogGroups () {
48
+ group := g .LogGroupName
49
+ if group == nil || ! re .MatchString (* group ) {
50
50
continue
51
51
}
52
52
53
+ groups = append (groups , * group )
54
+ }
55
+ if len (groups ) == 0 {
56
+ return fmt .Errorf ("no groups found matching pattern: %s" , pattern )
57
+ }
58
+
59
+ var wg sync.WaitGroup
60
+ for _ , group := range groups {
53
61
wg .Add (1 )
54
62
go func (group string ) {
55
63
defer wg .Done ()
56
64
fn (group )
57
- }(* name )
65
+ }(group )
58
66
}
59
67
60
68
wg .Wait ()
You can’t perform that action at this time.
0 commit comments