New Upstream Snapshot - golang-github-jinzhu-inflection
Ready changes
Summary
Merged new upstream version: 1.0.0+git20210111.1.b528103 (was: 1.0.0).
Resulting package
Built on 2022-10-18T01:05 (took 3m7s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots golang-github-jinzhu-inflection-dev
Lintian Result
- golang-github-jinzhu-inflection-dev_1.0.0+git20210111.1.b528103-1~jan+nus1_all.deb
- golang-github-jinzhu-inflection_1.0.0+git20210111.1.b528103-1~jan+nus1.dsc
- golang-github-jinzhu-inflection_1.0.0+git20210111.1.b528103-1~jan+nus1_amd64.buildinfo
- golang-github-jinzhu-inflection_1.0.0+git20210111.1.b528103-1~jan+nus1_amd64.changes
Diff
diff --git a/README.md b/README.md
index a3de336..50fe554 100644
--- a/README.md
+++ b/README.md
@@ -31,11 +31,11 @@ Standard rules are from Rails's ActiveSupport (https://github.com/rails/rails/bl
If you want to register more rules, follow:
-```
+```go
inflection.AddUncountable("fish")
inflection.AddIrregular("person", "people")
-inflection.AddPlural("(bu)s$", "${1}ses") # "bus" => "buses" / "BUS" => "BUSES" / "Bus" => "Buses"
-inflection.AddSingular("(bus)(es)?$", "${1}") # "buses" => "bus" / "Buses" => "Bus" / "BUSES" => "BUS"
+inflection.AddPlural("(bu)s$", "${1}ses") // "bus" => "buses" / "BUS" => "BUSES" / "Bus" => "Buses"
+inflection.AddSingular("(bus)(es)?$", "${1}") // "buses" => "bus" / "Buses" => "Bus" / "BUSES" => "BUS"
```
## Contributing
diff --git a/debian/changelog b/debian/changelog
index 756f707..371818f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+golang-github-jinzhu-inflection (1.0.0+git20210111.1.b528103-1) UNRELEASED; urgency=low
+
+ * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk> Tue, 18 Oct 2022 01:03:13 -0000
+
golang-github-jinzhu-inflection (1.0.0-1) unstable; urgency=medium
* New upstream release.
diff --git a/go.mod b/go.mod
index 2fb7690..5f98652 100644
--- a/go.mod
+++ b/go.mod
@@ -1 +1,3 @@
module github.com/jinzhu/inflection
+
+go 1.15
diff --git a/inflections.go b/inflections.go
index 606263b..e63b9a3 100644
--- a/inflections.go
+++ b/inflections.go
@@ -58,7 +58,7 @@ var pluralInflections = RegularSlice{
{"^(ax|test)is$", "${1}es"},
{"(octop|vir)us$", "${1}i"},
{"(octop|vir)i$", "${1}i"},
- {"(alias|status)$", "${1}es"},
+ {"(alias|status|campus)$", "${1}es"},
{"(bu)s$", "${1}ses"},
{"(buffal|tomat)o$", "${1}oes"},
{"([ti])um$", "${1}a"},
@@ -74,6 +74,7 @@ var pluralInflections = RegularSlice{
{"^(ox)$", "${1}en"},
{"^(oxen)$", "${1}"},
{"(quiz)$", "${1}zes"},
+ {"(drive)$", "${1}s"},
}
var singularInflections = RegularSlice{
@@ -93,7 +94,7 @@ var singularInflections = RegularSlice{
{"(c)ookies$", "${1}ookie"},
{"(x|ch|ss|sh)es$", "${1}"},
{"^(m|l)ice$", "${1}ouse"},
- {"(bus)(es)?$", "${1}"},
+ {"(bus|campus)(es)?$", "${1}"},
{"(o)es$", "${1}"},
{"(shoe)s$", "${1}"},
{"(cris|test)(is|es)$", "${1}is"},
@@ -105,6 +106,7 @@ var singularInflections = RegularSlice{
{"(matr)ices$", "${1}ix"},
{"(quiz)zes$", "${1}"},
{"(database)s$", "${1}"},
+ {"(drive)s$", "${1}"},
}
var irregularInflections = IrregularSlice{
@@ -113,17 +115,20 @@ var irregularInflections = IrregularSlice{
{"child", "children"},
{"sex", "sexes"},
{"move", "moves"},
- {"mombie", "mombies"},
+ {"ombie", "ombies"},
+ {"goose", "geese"},
+ {"foot", "feet"},
+ {"moose", "moose"},
+ {"tooth", "teeth"},
}
-var uncountableInflections = []string{"equipment", "information", "rice", "money", "species", "series", "fish", "sheep", "jeans", "police"}
+var uncountableInflections = []string{"equipment", "information", "rice", "money", "species", "series", "fish", "sheep", "jeans", "police", "milk", "salt", "time", "water", "paper", "food", "art", "cash", "music", "help", "luck", "oil", "progress", "rain", "research", "shopping", "software", "traffic"}
var compiledPluralMaps []inflection
var compiledSingularMaps []inflection
func compile() {
- compiledPluralMaps = []inflection{}
- compiledSingularMaps = []inflection{}
+ compiledPluralMaps, compiledSingularMaps = nil, nil
for _, uncountable := range uncountableInflections {
inf := inflection{
regexp: regexp.MustCompile("^(?i)(" + uncountable + ")$"),
@@ -135,18 +140,18 @@ func compile() {
for _, value := range irregularInflections {
infs := []inflection{
- inflection{regexp: regexp.MustCompile(strings.ToUpper(value.singular) + "$"), replace: strings.ToUpper(value.plural)},
- inflection{regexp: regexp.MustCompile(strings.Title(value.singular) + "$"), replace: strings.Title(value.plural)},
- inflection{regexp: regexp.MustCompile(value.singular + "$"), replace: value.plural},
+ {regexp: regexp.MustCompile(strings.ToUpper(value.singular) + "$"), replace: strings.ToUpper(value.plural)},
+ {regexp: regexp.MustCompile(strings.Title(value.singular) + "$"), replace: strings.Title(value.plural)},
+ {regexp: regexp.MustCompile(value.singular + "$"), replace: value.plural},
}
compiledPluralMaps = append(compiledPluralMaps, infs...)
}
for _, value := range irregularInflections {
infs := []inflection{
- inflection{regexp: regexp.MustCompile(strings.ToUpper(value.plural) + "$"), replace: strings.ToUpper(value.singular)},
- inflection{regexp: regexp.MustCompile(strings.Title(value.plural) + "$"), replace: strings.Title(value.singular)},
- inflection{regexp: regexp.MustCompile(value.plural + "$"), replace: value.singular},
+ {regexp: regexp.MustCompile(strings.ToUpper(value.plural) + "$"), replace: strings.ToUpper(value.singular)},
+ {regexp: regexp.MustCompile(strings.Title(value.plural) + "$"), replace: strings.Title(value.singular)},
+ {regexp: regexp.MustCompile(value.plural + "$"), replace: value.singular},
}
compiledSingularMaps = append(compiledSingularMaps, infs...)
}
@@ -154,9 +159,9 @@ func compile() {
for i := len(pluralInflections) - 1; i >= 0; i-- {
value := pluralInflections[i]
infs := []inflection{
- inflection{regexp: regexp.MustCompile(strings.ToUpper(value.find)), replace: strings.ToUpper(value.replace)},
- inflection{regexp: regexp.MustCompile(value.find), replace: value.replace},
- inflection{regexp: regexp.MustCompile("(?i)" + value.find), replace: value.replace},
+ {regexp: regexp.MustCompile(strings.ToUpper(value.find)), replace: strings.ToUpper(value.replace)},
+ {regexp: regexp.MustCompile(value.find), replace: value.replace},
+ {regexp: regexp.MustCompile("(?i)" + value.find), replace: value.replace},
}
compiledPluralMaps = append(compiledPluralMaps, infs...)
}
@@ -164,9 +169,9 @@ func compile() {
for i := len(singularInflections) - 1; i >= 0; i-- {
value := singularInflections[i]
infs := []inflection{
- inflection{regexp: regexp.MustCompile(strings.ToUpper(value.find)), replace: strings.ToUpper(value.replace)},
- inflection{regexp: regexp.MustCompile(value.find), replace: value.replace},
- inflection{regexp: regexp.MustCompile("(?i)" + value.find), replace: value.replace},
+ {regexp: regexp.MustCompile(strings.ToUpper(value.find)), replace: strings.ToUpper(value.replace)},
+ {regexp: regexp.MustCompile(value.find), replace: value.replace},
+ {regexp: regexp.MustCompile("(?i)" + value.find), replace: value.replace},
}
compiledSingularMaps = append(compiledSingularMaps, infs...)
}
diff --git a/inflections_test.go b/inflections_test.go
index 689e1df..b20b403 100644
--- a/inflections_test.go
+++ b/inflections_test.go
@@ -56,6 +56,29 @@ var inflections = map[string]string{
"information": "information",
"equipment": "equipment",
"criterion": "criteria",
+ "foot": "feet",
+ "goose": "geese",
+ "moose": "moose",
+ "tooth": "teeth",
+ "milk": "milk",
+ "salt": "salt",
+ "time": "time",
+ "water": "water",
+ "paper": "paper",
+ "music": "music",
+ "help": "help",
+ "luck": "luck",
+ "oil": "oil",
+ "progress": "progress",
+ "rain": "rain",
+ "research": "research",
+ "shopping": "shopping",
+ "software": "software",
+ "traffic": "traffic",
+ "zombie": "zombies",
+ "campus": "campuses",
+ "harddrive": "harddrives",
+ "drive": "drives",
}
// storage is used to restore the state of the global variables
Debdiff
File lists identical (after any substitutions)
No differences were encountered in the control files