Skip to content

Commit 0240528

Browse files
authored
Fix import linting rule for moved util package (#2378)
Update .golangci.yaml to reflect that util package is now at internal/shared/util (not internal/util), and update all imports to comply with the linting rule.
1 parent dcb1c7f commit 0240528

File tree

17 files changed

+36
-36
lines changed

17 files changed

+36
-36
lines changed

.golangci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ linters:
4040
alias: ctrl
4141
- pkg: github.com/blang/semver/v4
4242
alias: bsemver
43-
- pkg: ^github.com/operator-framework/operator-controller/internal/util/([^/]+)$
43+
- pkg: ^github.com/operator-framework/operator-controller/internal/shared/util/([^/]+)$
4444
alias: ${1}util
4545
exclusions:
4646
generated: lax

internal/catalogd/features/features.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
66
"k8s.io/component-base/featuregate"
77

8-
fgutil "github.com/operator-framework/operator-controller/internal/shared/util/featuregates"
8+
featuregatesutil "github.com/operator-framework/operator-controller/internal/shared/util/featuregates"
99
)
1010

1111
const (
@@ -24,5 +24,5 @@ func init() {
2424

2525
// LogFeatureGateStates logs the state of all known feature gates for catalogd
2626
func LogFeatureGateStates(log logr.Logger, fg featuregate.FeatureGate) {
27-
fgutil.LogFeatureGateStates(log, "catalogd feature gate status", fg, catalogdFeatureGates)
27+
featuregatesutil.LogFeatureGateStates(log, "catalogd feature gate status", fg, catalogdFeatureGates)
2828
}

internal/operator-controller/features/features.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
66
"k8s.io/component-base/featuregate"
77

8-
fgutil "github.com/operator-framework/operator-controller/internal/shared/util/featuregates"
8+
featuregatesutil "github.com/operator-framework/operator-controller/internal/shared/util/featuregates"
99
)
1010

1111
const (
@@ -90,5 +90,5 @@ func init() {
9090

9191
// LogFeatureGateStates logs the state of all known feature gates.
9292
func LogFeatureGateStates(log logr.Logger, fg featuregate.FeatureGate) {
93-
fgutil.LogFeatureGateStates(log, "feature gate status", fg, operatorControllerFeatureGates)
93+
featuregatesutil.LogFeatureGateStates(log, "feature gate status", fg, operatorControllerFeatureGates)
9494
}

internal/shared/util/testutils/artifacts.go renamed to internal/shared/util/test/artifacts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package testutils
1+
package test
22

33
import (
44
"context"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package testutils
1+
package test
22

33
import (
44
"context"
File renamed without changes.

internal/shared/util/testutils/templates/mermaid_chart.md.tmpl renamed to internal/shared/util/test/templates/mermaid_chart.md.tmpl

File renamed without changes.

internal/shared/util/testutils/templates/summary.md.tmpl renamed to internal/shared/util/test/templates/summary.md.tmpl

File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package testutils
1+
package test
22

33
import (
44
"os/exec"

test/e2e/cluster_extension_install_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"k8s.io/utils/ptr"
2323

2424
ocv1 "github.com/operator-framework/operator-controller/api/v1"
25-
utils "github.com/operator-framework/operator-controller/internal/shared/util/testutils"
25+
testutil "github.com/operator-framework/operator-controller/internal/shared/util/test"
2626
. "github.com/operator-framework/operator-controller/test/helpers"
2727
)
2828

@@ -59,7 +59,7 @@ func TestClusterExtensionInstallRegistry(t *testing.T) {
5959

6060
clusterExtension, extensionCatalog, sa, ns := TestInit(t)
6161
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
62-
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
62+
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)
6363

6464
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
6565
Source: ocv1.SourceConfig{
@@ -129,7 +129,7 @@ func TestClusterExtensionInstallRegistryDynamic(t *testing.T) {
129129

130130
clusterExtension, extensionCatalog, sa, ns := TestInit(t)
131131
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
132-
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
132+
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)
133133

134134
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
135135
Source: ocv1.SourceConfig{
@@ -203,7 +203,7 @@ func TestClusterExtensionInstallRegistryMultipleBundles(t *testing.T) {
203203
require.NoError(t, err)
204204

205205
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
206-
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
206+
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)
207207
defer func(cat *ocv1.ClusterCatalog) {
208208
require.NoError(t, c.Delete(context.Background(), cat))
209209
require.Eventually(t, func() bool {
@@ -254,7 +254,7 @@ func TestClusterExtensionBlockInstallNonSuccessorVersion(t *testing.T) {
254254

255255
clusterExtension, extensionCatalog, sa, ns := TestInit(t)
256256
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
257-
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
257+
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)
258258

259259
t.Log("By creating an ClusterExtension at a specified version")
260260
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
@@ -315,7 +315,7 @@ func TestClusterExtensionForceInstallNonSuccessorVersion(t *testing.T) {
315315

316316
clusterExtension, extensionCatalog, sa, ns := TestInit(t)
317317
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
318-
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
318+
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)
319319

320320
t.Log("By creating an ClusterExtension at a specified version")
321321
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
@@ -362,7 +362,7 @@ func TestClusterExtensionInstallSuccessorVersion(t *testing.T) {
362362
t.Log("When resolving upgrade edges")
363363
clusterExtension, extensionCatalog, sa, ns := TestInit(t)
364364
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
365-
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
365+
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)
366366

367367
t.Log("By creating an ClusterExtension at a specified version")
368368
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
@@ -408,7 +408,7 @@ func TestClusterExtensionInstallReResolvesWhenCatalogIsPatched(t *testing.T) {
408408
t.Log("It resolves again when a catalog is patched with new ImageRef")
409409
clusterExtension, extensionCatalog, sa, ns := TestInit(t)
410410
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
411-
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
411+
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)
412412

413413
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
414414
Source: ocv1.SourceConfig{
@@ -495,7 +495,7 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) {
495495
sa, err := CreateServiceAccount(context.Background(), types.NamespacedName{Name: clusterExtensionName, Namespace: ns.Name}, clusterExtensionName)
496496
require.NoError(t, err)
497497
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
498-
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
498+
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)
499499

500500
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
501501
Source: ocv1.SourceConfig{
@@ -553,7 +553,7 @@ func TestClusterExtensionInstallReResolvesWhenManagedContentChanged(t *testing.T
553553
t.Log("It resolves again when managed content is changed")
554554
clusterExtension, extensionCatalog, sa, ns := TestInit(t)
555555
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
556-
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
556+
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)
557557

558558
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
559559
Source: ocv1.SourceConfig{
@@ -607,7 +607,7 @@ func TestClusterExtensionRecoversFromNoNamespaceWhenFailureFixed(t *testing.T) {
607607
clusterExtension, extensionCatalog := TestInitClusterExtensionClusterCatalog(t)
608608

609609
defer TestCleanup(t, extensionCatalog, clusterExtension, nil, nil)
610-
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
610+
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)
611611

612612
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
613613
Source: ocv1.SourceConfig{
@@ -682,7 +682,7 @@ func TestClusterExtensionRecoversFromExistingDeploymentWhenFailureFixed(t *testi
682682
clusterExtension, extensionCatalog, sa, ns := TestInit(t)
683683

684684
defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns)
685-
defer utils.CollectTestArtifacts(t, artifactName, c, cfg)
685+
defer testutil.CollectTestArtifacts(t, artifactName, c, cfg)
686686

687687
clusterExtension.Spec = ocv1.ClusterExtensionSpec{
688688
Source: ocv1.SourceConfig{

0 commit comments

Comments
 (0)