Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rajha-korithrien opened this issue Mar 18, 2024 · 0 comments

Comments

@rajha-korithrien
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant