Skip to content

Commit 61fff2f

Browse files
🧹 Remove allDiscovery() in favor of All (aws, azure, gcp)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b61c278 commit 61fff2f

File tree

6 files changed

+12
-24
lines changed

6 files changed

+12
-24
lines changed

providers/aws/resources/discovery.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@ var All = append(
134134
DiscoveryECS,
135135
)
136136

137-
func allDiscovery() []string {
138-
return All
139-
}
140-
141137
func Discover(runtime *plugin.Runtime) (*inventory.Inventory, error) {
142138
conn := runtime.Connection.(*connection.AwsConnection)
143139
in := &inventory.Inventory{Spec: &inventory.InventorySpec{
@@ -168,7 +164,7 @@ func getDiscoveryTargets(config *inventory.Config) []string {
168164

169165
if stringx.Contains(targets, DiscoveryAll) {
170166
// return the All list + All Api Resources list
171-
return allDiscovery()
167+
return All
172168
}
173169

174170
// the targets we return.

providers/aws/resources/discovery_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ func TestDiscoveryAndFilterPropagation(t *testing.T) {
348348
}{
349349
{"empty returns empty (ParseCLI sets default)", []string{}, []string{}},
350350
{"auto keyword", []string{"auto"}, Auto},
351-
{"all keyword", []string{"all"}, allDiscovery()},
351+
{"all keyword", []string{"all"}, All},
352352
{"resources keyword", []string{"resources"}, AllAPIResources},
353353
{"explicit single", []string{"s3-buckets"}, []string{DiscoveryS3Buckets}},
354354
{
@@ -357,7 +357,7 @@ func TestDiscoveryAndFilterPropagation(t *testing.T) {
357357
[]string{DiscoveryS3Buckets, DiscoveryInstances, DiscoveryIAMUsers},
358358
},
359359
{"auto takes precedence", []string{"auto", "s3-buckets"}, Auto},
360-
{"all takes precedence", []string{"all", "s3-buckets"}, allDiscovery()},
360+
{"all takes precedence", []string{"all", "s3-buckets"}, All},
361361
}
362362

363363
for _, tc := range cases {
@@ -462,7 +462,7 @@ func TestGetDiscoveryTargets(t *testing.T) {
462462
{
463463
name: "all",
464464
targets: []string{"all"},
465-
want: allDiscovery(),
465+
want: All,
466466
},
467467
{
468468
name: "auto",
@@ -482,12 +482,12 @@ func TestGetDiscoveryTargets(t *testing.T) {
482482
{
483483
name: "all and resources",
484484
targets: []string{"all", "resources"},
485-
want: allDiscovery(),
485+
want: All,
486486
},
487487
{
488488
name: "all, auto and resources",
489489
targets: []string{"all", "resources"},
490-
want: allDiscovery(),
490+
want: All,
491491
},
492492
{
493493
name: "random",

providers/azure/resources/discovery.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ var All = append(
6666
DiscoveryStorageContainers,
6767
)
6868

69-
func allDiscovery() []string {
70-
return All
71-
}
72-
7369
var AllAPIResources = []string{
7470
DiscoveryInstancesApi,
7571
DiscoverySqlServers,
@@ -125,7 +121,7 @@ func getDiscoveryTargets(config *inventory.Config) []string {
125121
}
126122
if stringx.ContainsAnyOf(targets, DiscoveryAll) {
127123
// return the All list + All Api Resources list
128-
return allDiscovery()
124+
return All
129125
}
130126
if stringx.ContainsAnyOf(targets, DiscoveryAuto) {
131127
for i, target := range targets {

providers/azure/resources/discovery_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ func TestGetDiscoveryTargets(t *testing.T) {
7171
{
7272
name: "all",
7373
targets: []string{"all"},
74-
want: allDiscovery(),
74+
want: All,
7575
},
7676
{
7777
name: "all with extras",
7878
targets: []string{"all", "projects", "instances"},
79-
want: allDiscovery(),
79+
want: All,
8080
},
8181
{
8282
name: "auto",

providers/gcp/resources/discovery.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@ const (
6363
// All includes every discovery target: Auto covers all of them for GCP.
6464
var All = slices.Clone(Auto)
6565

66-
func allDiscovery() []string {
67-
return All
68-
}
69-
7066
var Auto = []string{
7167
DiscoveryOrganization,
7268
DiscoveryFolders,
@@ -140,7 +136,7 @@ func getDiscoveryTargets(config *inventory.Config) []string {
140136

141137
if stringx.ContainsAnyOf(targets, DiscoveryAll) {
142138
// return the All list + All Api Resources list
143-
return allDiscovery()
139+
return All
144140
}
145141
if stringx.ContainsAnyOf(targets, DiscoveryAuto) {
146142
for i, target := range targets {

providers/gcp/resources/discovery_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ func TestGetDiscoveryTargets(t *testing.T) {
9595
{
9696
name: "all",
9797
targets: []string{"all"},
98-
want: allDiscovery(),
98+
want: All,
9999
},
100100
{
101101
name: "all with extras",
102102
targets: []string{"all", "projects", "instances"},
103-
want: allDiscovery(),
103+
want: All,
104104
},
105105
{
106106
name: "auto",

0 commit comments

Comments
 (0)