Skip to content

Commit

Permalink
address linting errors
Browse files Browse the repository at this point in the history
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
  • Loading branch information
everettraven committed Oct 3, 2023
1 parent 3c8584e commit 8121fba
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
11 changes: 7 additions & 4 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"k8s.io/client-go/metadata"
_ "k8s.io/client-go/plugin/pkg/client/auth"

v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/sets"
Expand Down Expand Up @@ -133,7 +133,7 @@ func main() {
os.Exit(1)
}

unpacker, err := source.NewDefaultUnpacker(mgr, systemNamespace, cacheDir)
unpacker, err := source.NewDefaultUnpacker(systemNamespace, cacheDir)
if err != nil {
setupLog.Error(err, "unable to create unpacker")
os.Exit(1)
Expand Down Expand Up @@ -205,7 +205,10 @@ func main() {
os.Exit(1)
}

unpackStartupGarbageCollection(context.Background(), filepath.Join(cacheDir, source.UnpackCacheDir), setupLog, metaClient)
if err := unpackStartupGarbageCollection(context.Background(), filepath.Join(cacheDir, source.UnpackCacheDir), setupLog, metaClient); err != nil {
setupLog.Error(err, "running garbage collection")
os.Exit(1)
}

setupLog.Info("starting manager")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
Expand All @@ -224,7 +227,7 @@ func podNamespace() string {

func unpackStartupGarbageCollection(ctx context.Context, cachePath string, log logr.Logger, metaClient metadata.Interface) error {
getter := metaClient.Resource(v1alpha1.GroupVersion.WithResource("catalogs"))
metaList, err := getter.List(ctx, v1.ListOptions{})
metaList, err := getter.List(ctx, metav1.ListOptions{})
if err != nil {
return fmt.Errorf("error listing catalogs: %w", err)
}
Expand Down
5 changes: 3 additions & 2 deletions internal/source/image_registry_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ import (
"github.com/google/go-containerregistry/pkg/v1/mutate"
"github.com/google/go-containerregistry/pkg/v1/random"
"github.com/google/go-containerregistry/pkg/v1/remote"
"github.com/stretchr/testify/assert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/operator-framework/catalogd/api/core/v1alpha1"
"github.com/operator-framework/catalogd/internal/source"
"github.com/operator-framework/catalogd/pkg/errors"
"github.com/stretchr/testify/assert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func TestImageRegistry(t *testing.T) {
Expand Down
4 changes: 1 addition & 3 deletions internal/source/unpacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"os"
"path"

"sigs.k8s.io/controller-runtime/pkg/cluster"

catalogdv1alpha1 "github.com/operator-framework/catalogd/api/core/v1alpha1"
)

Expand Down Expand Up @@ -110,7 +108,7 @@ const UnpackCacheDir = "unpack"
// source types.
//
// TODO: refactor NewDefaultUnpacker due to growing parameter list
func NewDefaultUnpacker(systemNsCluster cluster.Cluster, namespace, cacheDir string) (Unpacker, error) {
func NewDefaultUnpacker(namespace, cacheDir string) (Unpacker, error) {
unpackPath := path.Join(cacheDir, UnpackCacheDir)
if err := os.MkdirAll(unpackPath, 0700); err != nil {
return nil, fmt.Errorf("creating unpack cache directory: %w", err)
Expand Down

0 comments on commit 8121fba

Please sign in to comment.