Skip to content

Commit 4c0dbf7

Browse files
janiszclaude
andcommitted
refactor: replace blank imports with explicit Init() in central compliance
Updated central/compliance/checks/all.go to call explicit Init() functions for all compliance standards instead of using blank imports. Added centralChecks.Init() call to central/app/app.go. Removed blank import from central/compliance/manager/checks.go. This completes the migration from automatic package-level init() to explicit initialization for all central compliance checks (76 total check files): - hipaa_164: 19 checks - nist800-190: 13 checks - nist80053: 20 checks - pcidss32: 24 checks - remote: wraps node checks Changes: - central/compliance/checks/all.go: blank imports → Init() calls - central/app/app.go: added centralChecks.Init() call - central/compliance/manager/checks.go: removed blank import Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent f8083d4 commit 4c0dbf7

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

central/app/app.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package app
22

33
import (
4+
centralChecks "github.com/stackrox/rox/central/compliance/checks"
45
"github.com/stackrox/rox/central/graphql/resolvers/loaders"
56
"github.com/stackrox/rox/central/metrics"
67
"github.com/stackrox/rox/pkg/compliance/checks"
@@ -25,4 +26,5 @@ func Run() {
2526
metrics.Init()
2627
loaders.Init()
2728
checks.Init()
29+
centralChecks.Init()
2830
}

central/compliance/checks/all.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
package checks
22

33
import (
4-
// Make sure all checks from all standards are registered.
5-
_ "github.com/stackrox/rox/central/compliance/checks/hipaa_164"
6-
_ "github.com/stackrox/rox/central/compliance/checks/nist800-190"
7-
_ "github.com/stackrox/rox/central/compliance/checks/nist80053"
8-
_ "github.com/stackrox/rox/central/compliance/checks/pcidss32"
9-
_ "github.com/stackrox/rox/central/compliance/checks/remote"
4+
"github.com/stackrox/rox/central/compliance/checks/hipaa_164"
5+
"github.com/stackrox/rox/central/compliance/checks/nist800-190"
6+
"github.com/stackrox/rox/central/compliance/checks/nist80053"
7+
"github.com/stackrox/rox/central/compliance/checks/pcidss32"
8+
"github.com/stackrox/rox/central/compliance/checks/remote"
109
)
10+
11+
// Init registers all central compliance checks.
12+
// Called explicitly from central/compliance/manager/checks.go instead of package init().
13+
func Init() {
14+
hipaa164.Init()
15+
nist800190.Init()
16+
nist80053.Init()
17+
pcidss32.Init()
18+
remote.Init()
19+
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
package manager
22

3-
import (
4-
_ "github.com/stackrox/rox/central/compliance/checks" // Make sure all checks are available
5-
)
3+
// Compliance checks are now registered explicitly via central/compliance/checks.Init()
4+
// called from central/app/app.go instead of automatic package init().

0 commit comments

Comments
 (0)