Skip to content

bug: flect behaves poorly on the string DNS which pluralizes to dnsDNSes #71

@rajha-korithrien

Description

@rajha-korithrien

Description

Description

Consider the example program:

package main

import (
	"fmt"
	"github.com/gobuffalo/flect"
)

func main() {

	orig := "CNS"
	result := flect.Pluralize(orig)
	fmt.Printf("plural of %s is: %s\n", orig, result)

	orig = "cns"
	result = flect.Pluralize(orig)
	fmt.Printf("plural of %s is: %s\n", orig, result)

	orig = "DNS"
	result = flect.Pluralize(orig)
	fmt.Printf("plural of %s is: %s\n", orig, result)

	orig = "dns"
	result = flect.Pluralize(orig)
	fmt.Printf("plural of %s is: %s\n", orig, result)

	orig = "ENS"
	result = flect.Pluralize(orig)
	fmt.Printf("plural of %s is: %s\n", orig, result)

	orig = "ens"
	result = flect.Pluralize(orig)
	fmt.Printf("plural of %s is: %s\n", orig, result)
}

Which will output:

plural of CNS is: CNSes
plural of cns is: cns
plural of DNS is: DNSes
plural of dns is: dnsDNSes
plural of ENS is: ENSes
plural of ens is: ens

Expected Behavior

I expect "dns" to behave the same as cns and ens to become dns NOT dnsDNSes

Actual Behavior

dns becomes dnsDNSes which doesn't seem correct and isn't the same as other similar 3 character strings.
Yes, DNS is the acronym for Domain Name System, but its plural should not result in lower case followed by uppercase right?

To Reproduce

Build the given go program using the latest release of flect
Run the program and observe the output to stdout

My test go.mod file is:

module flect-test

go 1.22.1

require github.com/gobuffalo/flect v1.0.2

Additional Context

Details: my example go.mod file is

module flect-test

go 1.22.1

require github.com/gobuffalo/flect v1.0.2

Which shows the flect version a v1.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions