Skip to content

Commit

Permalink
automated lint fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Keister <[email protected]>
  • Loading branch information
grokspawn committed Dec 20, 2024
1 parent b044ec9 commit 57eb7f5
Show file tree
Hide file tree
Showing 72 changed files with 161 additions and 178 deletions.
1 change: 0 additions & 1 deletion alpha/action/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ relatedImages:
name: operator
schema: olm.bundle
`

}

func migrateBarCatalogSqlite() string {
Expand Down
4 changes: 3 additions & 1 deletion alpha/action/migrations/migrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/require"

"github.com/operator-framework/api/pkg/operators/v1alpha1"

"github.com/operator-framework/operator-registry/alpha/declcfg"
"github.com/operator-framework/operator-registry/alpha/property"
"github.com/stretchr/testify/require"
)

func TestMigrations(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion alpha/action/render_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestRender(t *testing.T) {
testMigrations := migrations.Migrations{
Migrations: []migrations.Migration{
fauxMigration{"faux-migration", "my help text", func(d *declcfg.DeclarativeConfig) error {
for i, _ := range d.Bundles {
for i := range d.Bundles {
d.Bundles[i].Name = fmt.Sprintf("%s-MIGRATED", d.Bundles[i].Name)
}
return nil
Expand Down
3 changes: 1 addition & 2 deletions alpha/declcfg/declcfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import (
"errors"
"fmt"

prettyunmarshaler "github.com/operator-framework/operator-registry/pkg/prettyunmarshaler"

"golang.org/x/text/cases"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/sets"

"github.com/operator-framework/operator-registry/alpha/property"
prettyunmarshaler "github.com/operator-framework/operator-registry/pkg/prettyunmarshaler"
)

const (
Expand Down
1 change: 0 additions & 1 deletion alpha/declcfg/declcfg_to_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ func ConvertToModel(cfg DeclarativeConfig) (model.Model, error) {
deprecationsByPackage := sets.New[string]()

for i, deprecation := range cfg.Deprecations {

// no need to validate schema, since it could not be unmarshaled if missing/invalid

if deprecation.Package == "" {
Expand Down
1 change: 0 additions & 1 deletion alpha/declcfg/declcfg_to_model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ func TestConvertToModelBundle(t *testing.T) {
assert.Len(t, b.PropertiesP.BundleObjects, 2)
assert.Len(t, b.PropertiesP.Packages, 1)
assert.Equal(t, semver.MustParse("0.1.0"), b.Version)

}

func TestConvertToModelRoundtrip(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion alpha/declcfg/load_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (
"testing"

"github.com/blang/semver/v4"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/operator-framework/api/pkg/lib/version"
"github.com/operator-framework/api/pkg/operators/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/operator-framework/operator-registry/alpha/declcfg"
"github.com/operator-framework/operator-registry/alpha/property"
Expand Down
3 changes: 2 additions & 1 deletion alpha/property/property.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"fmt"
"reflect"

"github.com/operator-framework/api/pkg/operators/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/operator-framework/api/pkg/operators/v1alpha1"
)

type Property struct {
Expand Down
3 changes: 2 additions & 1 deletion alpha/template/converter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"io"
"os"

"sigs.k8s.io/yaml"

"github.com/operator-framework/operator-registry/alpha/template/basic"
"github.com/operator-framework/operator-registry/pkg/image"
"sigs.k8s.io/yaml"
)

type Converter struct {
Expand Down
2 changes: 0 additions & 2 deletions alpha/template/semver/semver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,6 @@ func TestGetVersionsFromStandardChannel(t *testing.T) {
require.EqualValues(t, "a", iosv.pkg) // verify that we learned the package name and stashed it in the receiver
})
}

}

func TestBailOnVersionBuildMetadata(t *testing.T) {
Expand Down Expand Up @@ -597,7 +596,6 @@ func TestBailOnVersionBuildMetadata(t *testing.T) {
}

func TestReadFile(t *testing.T) {

templateFstr := `---
schema: olm.semver
generateMajorChannels: %s
Expand Down
3 changes: 2 additions & 1 deletion cmd/opm/alpha/bundle/build.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package bundle

import (
"github.com/operator-framework/operator-registry/pkg/lib/bundle"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"

"github.com/operator-framework/operator-registry/pkg/lib/bundle"
)

var (
Expand Down
1 change: 0 additions & 1 deletion cmd/opm/alpha/convert-template/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ This command outputs a basic catalog template to STDOUT from input FBC.
If no argument is specified or is '-' input is assumed from STDIN.
`,
RunE: func(c *cobra.Command, args []string) error {

switch output {
case "yaml", "json":
converter.OutputFormat = output
Expand Down
3 changes: 1 addition & 2 deletions cmd/opm/index/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ func addIndexAddCmd(parent *cobra.Command, showAlphaHelp bool) {
// Set the example after the parent has been set to get the correct command path
parent.AddCommand(indexCmd)
indexCmd.Example = fmt.Sprintf(addExample, indexCmd.CommandPath())

}

func runIndexAddCmdFunc(cmd *cobra.Command, _ []string) error {
Expand Down Expand Up @@ -213,7 +212,7 @@ func getContainerTools(cmd *cobra.Command) (string, string, error) {
return "", "", err
}

// Backwards compatiblity mode
// Backwards compatibility mode
if containerTool != "" {
if pullTool == "" && buildTool == "" {
return containerTool, containerTool, nil
Expand Down
1 change: 0 additions & 1 deletion cmd/opm/index/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func newIndexDeleteCmd() *cobra.Command {
}

return indexCmd

}

func runIndexDeleteCmdFunc(cmd *cobra.Command, _ []string) error {
Expand Down
1 change: 0 additions & 1 deletion cmd/opm/index/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ func newIndexExportCmd() *cobra.Command {
}

return indexCmd

}

func runIndexExportCmdFunc(cmd *cobra.Command, _ []string) error {
Expand Down
1 change: 0 additions & 1 deletion cmd/opm/index/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func newIndexPruneCmd() *cobra.Command {
}

return indexCmd

}

func runIndexPruneCmdFunc(cmd *cobra.Command, _ []string) error {
Expand Down
1 change: 0 additions & 1 deletion cmd/opm/index/prunestranded.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func newIndexPruneStrandedCmd() *cobra.Command {
}

return indexCmd

}

func runIndexPruneStrandedCmdFunc(cmd *cobra.Command, _ []string) error {
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/model_to_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"encoding/json"
"fmt"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/operator-framework/api/pkg/lib/version"
"github.com/operator-framework/api/pkg/operators"
"github.com/operator-framework/api/pkg/operators/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/operator-framework/operator-registry/alpha/model"
"github.com/operator-framework/operator-registry/alpha/property"
Expand Down Expand Up @@ -152,7 +153,6 @@ func gvksRequirestoAPIGVKs(in []property.GVKRequired) []*GroupVersionKind {
func convertModelPropertiesToAPIProperties(props []property.Property) []*Property {
var out []*Property
for _, prop := range props {

// NOTE: This is a special case filter to prevent problems with existing client implementations that
// project bundle properties into CSV annotations and store those CSVs in a size-constrained
// storage backend (e.g. etcd via kube-apiserver). If the bundle object property has data inlined
Expand Down
2 changes: 1 addition & 1 deletion pkg/cache/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestJSON_StableDigest(t *testing.T) {
require.NoError(t, err)

// NOTE: The entire purpose of this test is to ensure that we don't change the cache
// implementation and inadvertantly invalidate existing caches.
// implementation and inadvertently invalidate existing caches.
//
// Therefore, DO NOT CHANGE the expected digest value here unless validFS also
// changes.
Expand Down
2 changes: 1 addition & 1 deletion pkg/cache/pogrebv1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestPogrebV1_StableDigest(t *testing.T) {
require.NoError(t, err)

// NOTE: The entire purpose of this test is to ensure that we don't change the cache
// implementation and inadvertantly invalidate existing caches.
// implementation and inadvertently invalidate existing caches.
//
// Therefore, DO NOT CHANGE the expected digest value here unless validFS also
// changes.
Expand Down
5 changes: 3 additions & 2 deletions pkg/configmap/configmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import (
"os"
"testing"

"github.com/operator-framework/operator-registry/pkg/api"
unstructuredlib "github.com/operator-framework/operator-registry/pkg/lib/unstructured"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/yaml"
"k8s.io/client-go/kubernetes/fake"

"github.com/operator-framework/operator-registry/pkg/api"
unstructuredlib "github.com/operator-framework/operator-registry/pkg/lib/unstructured"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion pkg/configmap/configmap_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (c *ConfigMapWriter) Populate(maxDataSizeLimit uint64) error {
logrus.WithFields(logrus.Fields{
"file.Name": file.Name(),
"validConfigMapKey": validConfigMapKey,
}).Info("translated filename for configmap comptability")
}).Info("translated filename for configmap compatibility")
}

if c.gzip {
Expand Down
2 changes: 1 addition & 1 deletion pkg/image/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestMockRegistry(t *testing.T) {

r := MockRegistry{
RemoteImages: map[Reference]*MockImage{
exists: &MockImage{
exists: {
Labels: map[string]string{
"key1": "value1",
"key2": "value2",
Expand Down
1 change: 0 additions & 1 deletion pkg/lib/bundle/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ func NewExporterForBundle(image, directory string, containerTool containertools.
}

func (i *BundleExporter) Export(skipTLSVerify, plainHTTP bool) error {

log := logrus.WithField("img", i.image)

tmpDir, err := os.MkdirTemp("./", "bundle_tmp")
Expand Down
3 changes: 2 additions & 1 deletion pkg/lib/bundle/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package bundle
import (
"testing"

"github.com/operator-framework/operator-registry/pkg/containertools"
"github.com/stretchr/testify/assert"

"github.com/operator-framework/operator-registry/pkg/containertools"
)

func TestExportForBundleWithBadImage(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/bundle/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func GenerateFunc(directory, outputDir, packageName, channels, channelDefault st
// CopyYamlOutput takes the generated annotations yaml and writes it to disk.
// If an outputDir is specified, it will copy the input manifests
// It returns two strings. resultMetadata is the path to the output metadata/ folder.
// resultManifests is the path to the output manifests/ folder -- if no copy occured,
// resultManifests is the path to the output manifests/ folder -- if no copy occurred,
// it just returns the input manifestDir
func CopyYamlOutput(annotationsContent []byte, manifestDir, outputDir, workingDir string, overwrite bool) (resultManifests, resultMetadata string, err error) {
// First, determine the parent directory of the metadata and manifest directories
Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/bundle/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewBundleDirInterperter(bundleDir string) (*bundleDirInterpreter, error) {

func (b *bundleDirInterpreter) GetBundleChannels() (channelNames []string) {
for channelName, channel := range b.pkg.Channels {
for bundle, _ := range channel.Nodes {
for bundle := range channel.Nodes {
if bundle.CsvName == b.bundleCsvName {
channelNames = append(channelNames, channelName)
break
Expand Down
1 change: 1 addition & 0 deletions pkg/lib/bundle/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/operator-framework/api/pkg/manifests"
v1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
v "github.com/operator-framework/api/pkg/validation"

"github.com/operator-framework/operator-registry/pkg/image"
validation "github.com/operator-framework/operator-registry/pkg/lib/validation"
"github.com/operator-framework/operator-registry/pkg/registry"
Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/indexer/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ func getBundlesToExport(dbQuerier pregistry.Query, packages []string) (map[strin
if err != nil {
return nil, err
}
for k, _ := range bundlesForPackage {
for k := range bundlesForPackage {
bundleMap[k.BundlePath] = bundleDirPrefix{pkgName: packageName, bundleVersion: k.Version}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/indexer/indexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestGetBundlesToExport(t *testing.T) {
}

var bundleImages []string
for bundlePath, _ := range bundleMap {
for bundlePath := range bundleMap {
bundleImages = append(bundleImages, bundlePath)
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/lib/indexer/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
package indexer

import (
"github.com/sirupsen/logrus"

"github.com/operator-framework/operator-registry/pkg/containertools"
"github.com/operator-framework/operator-registry/pkg/lib/registry"
"github.com/sirupsen/logrus"
)

// IndexAdder allows the creation of index container images from scratch or
Expand Down
2 changes: 0 additions & 2 deletions pkg/lib/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ func populate(ctx context.Context, loader registry.Load, graphLoader registry.Gr
populator := registry.NewDirectoryPopulator(loader, graphLoader, querier, unpackedImageMap, overwrittenBundles)

if err := populator.Populate(mode); err != nil {

return err

}
return checkForBundles(ctx, querier.(*sqlite.SQLQuerier), graphLoader, imagesToAdd)
}
Expand Down
1 change: 0 additions & 1 deletion pkg/lib/registry/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,6 @@ func TestCheckForBundles(t *testing.T) {
overwriteRefs[img.Bundle.Package] = append(overwriteRefs[img.Bundle.Package], name)
}
refs[image.SimpleReference(bundleImage)] = dir

}
require.NoError(t, registry.NewDirectoryPopulator(
load,
Expand Down
4 changes: 2 additions & 2 deletions pkg/lib/unstructured/unstructured.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"path"
"strings"

"github.com/operator-framework/operator-registry/pkg/api"

"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/util/yaml"

"github.com/operator-framework/operator-registry/pkg/api"
)

func FromReader(reader io.Reader) (*unstructured.Unstructured, error) {
Expand Down
1 change: 1 addition & 0 deletions pkg/lib/validation/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/operator-framework/api/pkg/validation/errors"
interfaces "github.com/operator-framework/api/pkg/validation/interfaces"

"github.com/operator-framework/operator-registry/pkg/registry"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/lib/validation/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"strings"
"testing"

"github.com/operator-framework/operator-registry/pkg/registry"
"github.com/stretchr/testify/require"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

k8syaml "k8s.io/apimachinery/pkg/util/yaml"

"github.com/operator-framework/operator-registry/pkg/registry"
)

func TestValidateBundle(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion pkg/prettyunmarshaler/prettyunmarshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ func (e *JsonUnmarshalError) Pretty() string {
// We found the byte in the pretty data that matches the byte in the original data,
// so increment the pretty index.
pIndex++

}

_, _ = sb.Write(pretty[:pOffset])
Expand Down
Loading

0 comments on commit 57eb7f5

Please sign in to comment.