diff --git a/go.mod b/go.mod index 81f294b00..461b0fc6c 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/fatih/color v1.18.0 github.com/gobuffalo/flect v1.0.3 github.com/google/go-cmp v0.6.0 + github.com/jinzhu/inflection v1.0.0 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.35.1 github.com/spf13/cobra v1.8.1 diff --git a/go.sum b/go.sum index 051f6ac67..5071480a6 100644 --- a/go.sum +++ b/go.sum @@ -42,6 +42,8 @@ github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAx github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= diff --git a/pkg/crd/spec.go b/pkg/crd/spec.go index 5fd246c3f..fb543d077 100644 --- a/pkg/crd/spec.go +++ b/pkg/crd/spec.go @@ -20,7 +20,7 @@ import ( "sort" "strings" - "github.com/gobuffalo/flect" + "github.com/jinzhu/inflection" apiext "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -63,7 +63,7 @@ func (p *Parser) NeedCRDFor(groupKind schema.GroupKind, maxDescLen *int) { packages = append(packages, pkg) } - defaultPlural := strings.ToLower(flect.Pluralize(groupKind.Kind)) + defaultPlural := strings.ToLower(inflection.Plural(groupKind.Kind)) crd := apiext.CustomResourceDefinition{ TypeMeta: metav1.TypeMeta{ APIVersion: apiext.SchemeGroupVersion.String(), diff --git a/pkg/typescaffold/resource.go b/pkg/typescaffold/resource.go index 7024a7c8a..5d0ba8eb9 100644 --- a/pkg/typescaffold/resource.go +++ b/pkg/typescaffold/resource.go @@ -21,6 +21,7 @@ import ( "strings" "github.com/gobuffalo/flect" + "github.com/jinzhu/inflection" ) // Resource contains the information required to scaffold files for a resource. @@ -42,7 +43,7 @@ func (r *Resource) Validate() error { } if len(r.Resource) == 0 { - r.Resource = flect.Pluralize(strings.ToLower(r.Kind)) + r.Resource = inflection.Plural(strings.ToLower(r.Kind)) } if r.Kind != flect.Pascalize(r.Kind) {