Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
Signed-off-by: Alper Rifat Ulucinar <ulucinar@users.noreply.github.com>
  • Loading branch information
ulucinar committed Jan 9, 2024
1 parent a94d692 commit 1906bf1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions pkg/config/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"fmt"
"time"

"github.com/crossplane/upjet/pkg/config/conversion"

xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
"github.com/crossplane/crossplane-runtime/pkg/fieldpath"
"github.com/crossplane/crossplane-runtime/pkg/reconciler/managed"
Expand All @@ -23,6 +21,7 @@ import (
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/crossplane/upjet/pkg/config/conversion"
"github.com/crossplane/upjet/pkg/registry"
)

Expand Down
3 changes: 1 addition & 2 deletions pkg/controller/conversion/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ import (
"k8s.io/apimachinery/pkg/runtime"

"github.com/crossplane/upjet/pkg/config/conversion"

"github.com/crossplane/upjet/pkg/resource"
)

// RoundTrip round-trips from `src` to `dst` via an unstructured map[string]any
// representation of the `src` object and applies the registered webhook
// conversion functions.
func RoundTrip(dst, src resource.Terraformed) error {
func RoundTrip(dst, src resource.Terraformed) error { //nolint:gocyclo // considered breaking this according to the converters and I did not like it
srcMap, err := runtime.DefaultUnstructuredConverter.ToUnstructured(src)
if err != nil {
return errors.Wrap(err, "cannot convert the conversion source object into the map[string]any representation")
Expand Down
7 changes: 4 additions & 3 deletions pkg/pipeline/conversion_spoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type ConversionSpokeGenerator struct {
}

// Generate writes generated conversion.Convertible interface functions
func (cg *ConversionSpokeGenerator) Generate(cfgs []*terraformedInput) error {
func (cg *ConversionSpokeGenerator) Generate(cfgs []*terraformedInput) error { //nolint:gocyclo
entries, err := os.ReadDir(cg.LocalDirectoryPath)
if err != nil {
return errors.Wrapf(err, "cannot list the directory entries for the source folder %s while generating the conversion.Convertible interface functions", cg.LocalDirectoryPath)
Expand Down Expand Up @@ -91,7 +91,8 @@ func (cg *ConversionSpokeGenerator) Generate(cfgs []*terraformedInput) error {
"Kind": c.Kind,
},
})
cg.SpokeVersionsMap[fmt.Sprintf("%s.%s", c.ShortGroup, c.Kind)] = append(cg.SpokeVersionsMap[c.Kind], filepath.Base(versionDir))
sk := fmt.Sprintf("%s.%s", c.ShortGroup, c.Kind)
cg.SpokeVersionsMap[sk] = append(cg.SpokeVersionsMap[sk], filepath.Base(versionDir))
}

vars["Resources"] = resources
Expand All @@ -104,7 +105,7 @@ func (cg *ConversionSpokeGenerator) Generate(cfgs []*terraformedInput) error {

func findKindTerraformedInput(cfgs []*terraformedInput, name string) *terraformedInput {
for _, c := range cfgs {
if name == strings.ToLower(c.Kind) {
if strings.EqualFold(name, c.Kind) {
return c
}
}
Expand Down

0 comments on commit 1906bf1

Please sign in to comment.