Repository: sacloud/usacloud
Pull request #937 (2022-06-30 03:50:38)

go: bump github.com/huandu/xstrings from 1.3.0 to 1.3.2
Bumps [github.com/huandu/xstrings](https://github.com/huandu/xstrings) from 1.3.0 to 1.3.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/huandu/xstrings/releases">github.com/huandu/xstrings's releases</a>.</em></p>
<blockquote>
<h2>Use <code>strings.Builder</code> for better performance if it's available</h2>
<p>See <a href="https://github-redirect.dependabot.com/huandu/xstrings/issues/46">#46</a> for details. Thanks, <a href="https://github.com/ninedraft"><code>@​ninedraft</code></a>.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/huandu/xstrings/commit/52197b1fb3155666d9613b4eb4ed72a86d1f8ab6"><code>52197b1</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/huandu/xstrings/issues/46">#46</a> from ninedraft/use-strings-builder</li>
<li><a href="https://github.com/huandu/xstrings/commit/ac7d5dba631a4e290307ddcf615c741cded1eefc"><code>ac7d5db</code></a> rfr(package): rename stringBuffer to stringBuilder</li>
<li><a href="https://github.com/huandu/xstrings/commit/225e7bf383e67e74f6439018fe2b1ca741caa2f9"><code>225e7bf</code></a> rfr(string buffer): rename stringbuffer* to stringbuilder</li>
<li><a href="https://github.com/huandu/xstrings/commit/dd8a951e688fcfa6390e0cf7a19ec19d67a85efe"><code>dd8a951</code></a> fix(package): use bufferString type alias instead of string builder</li>
<li><a href="https://github.com/huandu/xstrings/commit/a81d2954276fd9be245272d46fd800f1c8658717"><code>a81d295</code></a> fix(buffer): type aliases for back compatibility with go &lt;= 1.10</li>
<li><a href="https://github.com/huandu/xstrings/commit/ee63bf74d2de2daeb8e56e4fcd326781cce2a3d6"><code>ee63bf7</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/huandu/xstrings/issues/47">#47</a> from ninedraft/fix-ineffectual-assignment</li>
<li><a href="https://github.com/huandu/xstrings/commit/6e34c261b41b600acd24c80d748907d892a07df3"><code>6e34c26</code></a> style(translage): unnecessary placeholder assignment.</li>
<li><a href="https://github.com/huandu/xstrings/commit/6407db4219dd9a4741da8fc62de54cf9fddc0c7d"><code>6407db4</code></a> fix(convert test): use a new random source in the test to avoid indetermenist...</li>
<li><a href="https://github.com/huandu/xstrings/commit/1bd3ff7ee236aa4a431303840c4ef371895bf60e"><code>1bd3ff7</code></a> fix(convert test): fix shuffle tests</li>
<li><a href="https://github.com/huandu/xstrings/commit/612481869d7f61163966da0de9bf3443c8b80b16"><code>6124818</code></a> fix(conver test): ineffectual assignment in the testShuffleSource.Int63 method</li>
<li>Additional commits viewable in <a href="https://github.com/huandu/xstrings/compare/v1.3.0...v1.3.2">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/huandu/xstrings&package-manager=go_modules&previous-version=1.3.0&new-version=1.3.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/go.mod b/go.mod
index f3b5bc08..0f12fc88 100644
--- a/go.mod
+++ b/go.mod
@@ -7,12 +7,12 @@ require (
 	github.com/fatih/color v1.13.0
 	github.com/fatih/structs v1.1.0
 	github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
-	github.com/go-playground/validator/v10 v10.10.1
+	github.com/go-playground/validator/v10 v10.11.0
 	github.com/hashicorp/go-version v1.5.0
 	github.com/hashicorp/hc-install v0.4.0
 	github.com/hashicorp/terraform-exec v0.17.1
 	github.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519
-	github.com/huandu/xstrings v1.3.0
+	github.com/huandu/xstrings v1.3.2
 	github.com/itchyny/gojq v0.12.8
 	github.com/jmespath/go-jmespath v0.4.0
 	github.com/mattn/go-colorable v0.1.12
diff --git a/go.sum b/go.sum
index 6c40baf0..65335ad0 100644
--- a/go.sum
+++ b/go.sum
@@ -155,8 +155,8 @@ github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb
 github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs=
 github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho=
 github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA=
-github.com/go-playground/validator/v10 v10.10.1 h1:uA0+amWMiglNZKZ9FJRKUAe9U3RX91eVn1JYXMWt7ig=
-github.com/go-playground/validator/v10 v10.10.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU=
+github.com/go-playground/validator/v10 v10.11.0 h1:0W+xRM511GY47Yy3bZUbJVitCNg2BOGlCyvTqsp/xIw=
+github.com/go-playground/validator/v10 v10.11.0/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU=
 github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
 github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
 github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
@@ -291,8 +291,8 @@ github.com/hashicorp/terraform-json v0.14.0/go.mod h1:5A9HIWPkk4e5aeeXIBbkcOvaZb
 github.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519 h1:nqAlWFEdqI0ClbTDrhDvE/8LeQ4pftrqKUX9w5k0j3s=
 github.com/hokaccha/go-prettyjson v0.0.0-20210113012101-fb4e108d2519/go.mod h1:pFlLw2CfqZiIBOx6BuCeRLCrfxBJipTY0nIOF/VbGcI=
 github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
-github.com/huandu/xstrings v1.3.0 h1:gvV6jG9dTgFEncxo+AF7PH6MZXi/vZl25owA/8Dg8Wo=
-github.com/huandu/xstrings v1.3.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
+github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
+github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
 github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
 github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
 github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
diff --git a/pkg/commands/iaas/ipv6addr/zz_create_gen.go b/pkg/commands/iaas/ipv6addr/zz_create_gen.go
index d8cf7aa7..62b84eee 100644
--- a/pkg/commands/iaas/ipv6addr/zz_create_gen.go
+++ b/pkg/commands/iaas/ipv6addr/zz_create_gen.go
@@ -38,7 +38,7 @@ func (p *createParameter) buildFlags(fs *pflag.FlagSet) {
 	fs.StringVarP(&p.Format, "format", "", p.Format, "Output format in Go templates (aliases: --fmt)")
 	fs.StringVarP(&p.Query, "query", "", p.Query, "Query for JSON output")
 	fs.StringVarP(&p.QueryDriver, "query-driver", "", p.QueryDriver, "Name of the driver that handles queries to JSON output options: [jmespath/jq]")
-	fs.StringVarP(&p.IPv6Addr, "ipv6addr", "", p.IPv6Addr, "(*required) ")
+	fs.StringVarP(&p.IPv6Addr, "i-pv6-addr", "", p.IPv6Addr, "(*required) ")
 	fs.StringVarP(&p.HostName, "host-name", "", p.HostName, "(*required) ")
 	fs.SetNormalizeFunc(p.normalizeFlagName)
 }
@@ -62,7 +62,7 @@ func (p *createParameter) buildFlagsUsage(cmd *cobra.Command) {
 		fs = pflag.NewFlagSet("ipv6addr", pflag.ContinueOnError)
 		fs.SortFlags = false
 		fs.AddFlag(cmd.LocalFlags().Lookup("host-name"))
-		fs.AddFlag(cmd.LocalFlags().Lookup("ipv6addr"))
+		fs.AddFlag(cmd.LocalFlags().Lookup("i-pv6-addr"))
 		sets = append(sets, &core.FlagSet{
 			Title: "Ipv6addr-specific options",
 			Flags: fs,
diff --git a/pkg/commands/iaas/ipv6addr/zz_delete_gen.go b/pkg/commands/iaas/ipv6addr/zz_delete_gen.go
index 17d80262..a37354b7 100644
--- a/pkg/commands/iaas/ipv6addr/zz_delete_gen.go
+++ b/pkg/commands/iaas/ipv6addr/zz_delete_gen.go
@@ -38,7 +38,7 @@ func (p *deleteParameter) buildFlags(fs *pflag.FlagSet) {
 	fs.StringVarP(&p.Format, "format", "", p.Format, "Output format in Go templates (aliases: --fmt)")
 	fs.StringVarP(&p.Query, "query", "", p.Query, "Query for JSON output")
 	fs.StringVarP(&p.QueryDriver, "query-driver", "", p.QueryDriver, "Name of the driver that handles queries to JSON output options: [jmespath/jq]")
-	fs.StringVarP(&p.IPv6Addr, "ipv6addr", "", p.IPv6Addr, "(*required) ")
+	fs.StringVarP(&p.IPv6Addr, "i-pv6-addr", "", p.IPv6Addr, "(*required) ")
 	fs.BoolVarP(&p.FailIfNotFound, "fail-if-not-found", "", p.FailIfNotFound, "")
 	fs.SetNormalizeFunc(p.normalizeFlagName)
 }
@@ -61,7 +61,7 @@ func (p *deleteParameter) buildFlagsUsage(cmd *cobra.Command) {
 		var fs *pflag.FlagSet
 		fs = pflag.NewFlagSet("ipv6addr", pflag.ContinueOnError)
 		fs.SortFlags = false
-		fs.AddFlag(cmd.LocalFlags().Lookup("ipv6addr"))
+		fs.AddFlag(cmd.LocalFlags().Lookup("i-pv6-addr"))
 		sets = append(sets, &core.FlagSet{
 			Title: "Ipv6addr-specific options",
 			Flags: fs,
diff --git a/pkg/commands/iaas/ipv6addr/zz_read_gen.go b/pkg/commands/iaas/ipv6addr/zz_read_gen.go
index 327f8e98..449bb8b1 100644
--- a/pkg/commands/iaas/ipv6addr/zz_read_gen.go
+++ b/pkg/commands/iaas/ipv6addr/zz_read_gen.go
@@ -37,7 +37,7 @@ func (p *readParameter) buildFlags(fs *pflag.FlagSet) {
 	fs.StringVarP(&p.Format, "format", "", p.Format, "Output format in Go templates (aliases: --fmt)")
 	fs.StringVarP(&p.Query, "query", "", p.Query, "Query for JSON output")
 	fs.StringVarP(&p.QueryDriver, "query-driver", "", p.QueryDriver, "Name of the driver that handles queries to JSON output options: [jmespath/jq]")
-	fs.StringVarP(&p.IPv6Addr, "ipv6addr", "", p.IPv6Addr, "(*required) ")
+	fs.StringVarP(&p.IPv6Addr, "i-pv6-addr", "", p.IPv6Addr, "(*required) ")
 	fs.SetNormalizeFunc(p.normalizeFlagName)
 }
 
@@ -59,7 +59,7 @@ func (p *readParameter) buildFlagsUsage(cmd *cobra.Command) {
 		var fs *pflag.FlagSet
 		fs = pflag.NewFlagSet("ipv6addr", pflag.ContinueOnError)
 		fs.SortFlags = false
-		fs.AddFlag(cmd.LocalFlags().Lookup("ipv6addr"))
+		fs.AddFlag(cmd.LocalFlags().Lookup("i-pv6-addr"))
 		sets = append(sets, &core.FlagSet{
 			Title: "Ipv6addr-specific options",
 			Flags: fs,
diff --git a/pkg/commands/iaas/ipv6addr/zz_update_gen.go b/pkg/commands/iaas/ipv6addr/zz_update_gen.go
index f5af81a5..c91dcf5e 100644
--- a/pkg/commands/iaas/ipv6addr/zz_update_gen.go
+++ b/pkg/commands/iaas/ipv6addr/zz_update_gen.go
@@ -38,7 +38,7 @@ func (p *updateParameter) buildFlags(fs *pflag.FlagSet) {
 	fs.StringVarP(&p.Format, "format", "", p.Format, "Output format in Go templates (aliases: --fmt)")
 	fs.StringVarP(&p.Query, "query", "", p.Query, "Query for JSON output")
 	fs.StringVarP(&p.QueryDriver, "query-driver", "", p.QueryDriver, "Name of the driver that handles queries to JSON output options: [jmespath/jq]")
-	fs.StringVarP(&p.IPv6Addr, "ipv6addr", "", p.IPv6Addr, "(*required) ")
+	fs.StringVarP(&p.IPv6Addr, "i-pv6-addr", "", p.IPv6Addr, "(*required) ")
 	fs.StringVarP(&p.HostName, "host-name", "", p.HostName, "(*required) ")
 	fs.SetNormalizeFunc(p.normalizeFlagName)
 }
@@ -62,7 +62,7 @@ func (p *updateParameter) buildFlagsUsage(cmd *cobra.Command) {
 		fs = pflag.NewFlagSet("ipv6addr", pflag.ContinueOnError)
 		fs.SortFlags = false
 		fs.AddFlag(cmd.LocalFlags().Lookup("host-name"))
-		fs.AddFlag(cmd.LocalFlags().Lookup("ipv6addr"))
+		fs.AddFlag(cmd.LocalFlags().Lookup("i-pv6-addr"))
 		sets = append(sets, &core.FlagSet{
 			Title: "Ipv6addr-specific options",
 			Flags: fs,
diff --git a/pkg/naming/functions.go b/pkg/naming/functions.go
index e6c664d7..4bc264b9 100644
--- a/pkg/naming/functions.go
+++ b/pkg/naming/functions.go
@@ -30,6 +30,8 @@ var normalizationWords = map[string]string{
 	"Ipv6":   "IPv6",
 	"iPv4":   "ipv4",
 	"iPv6":   "ipv6",
+	"i_pv4":  "ipv4",
+	"i_pv6":  "ipv6",
 	"i_pv_4": "ipv4",
 	"i_pv_6": "ipv6",
 	"ipv_4":  "ipv4",


Test patch:
diff --git a/pkg/validate/validator_test.go b/pkg/validate/validator_test.go
index 87a51120..b16cb9c4 100644
--- a/pkg/validate/validator_test.go
+++ b/pkg/validate/validator_test.go
@@ -38,7 +38,7 @@ func TestValidator_Exec(t *testing.T) {
 	require.EqualError(t, err, strings.Join([]string{
 		"validation error:",
 		"\t--required: required",
-		"\t--min-2: min=2",
-		"\t--max-5: max=5",
+		"\t--min2: min=2",
+		"\t--max5: max=5",
 	}, "\n"))
 }
diff --git a/tools/clitag/parser_test.go b/tools/clitag/parser_test.go
index 16a1f0f8..c3961884 100644
--- a/tools/clitag/parser_test.go
+++ b/tools/clitag/parser_test.go
@@ -132,7 +132,7 @@ func TestParser_Parse(t *testing.T) {
 					StructField: reflect.TypeOf(nested1{}).Field(0),
 					Tag: Tag{
 						FieldName: "Nested1.Field1",
-						FlagName:  "nested-1-field-1",
+						FlagName:  "nested1-field1",
 						Category:  "parent",
 					},
 				},
@@ -140,7 +140,7 @@ func TestParser_Parse(t *testing.T) {
 					StructField: reflect.TypeOf(nested2{}).Field(0),
 					Tag: Tag{
 						FieldName: "Nested1.Field2.Field1",
-						FlagName:  "nested-1-field-2-field-1",
+						FlagName:  "nested1-field2-field1",
 						Category:  "parent",
 					},
 				},
@@ -153,7 +153,7 @@ func TestParser_Parse(t *testing.T) {
 					StructField: reflect.TypeOf(nested1{}).Field(0),
 					Tag: Tag{
 						FieldName: "Nested1.Field1",
-						FlagName:  "field-1",
+						FlagName:  "field1",
 						Category:  "parent",
 					},
 				},
@@ -161,7 +161,7 @@ func TestParser_Parse(t *testing.T) {
 					StructField: reflect.TypeOf(nested2{}).Field(0),
 					Tag: Tag{
 						FieldName: "Nested1.Field2.Field1",
-						FlagName:  "field-2-field-1",
+						FlagName:  "field2-field1",
 						Category:  "parent",
 					},
 				},
@@ -169,14 +169,14 @@ func TestParser_Parse(t *testing.T) {
 					StructField: reflect.TypeOf(nested1{}).Field(0),
 					Tag: Tag{
 						FieldName: "Nested2.Nested1.Field1",
-						FlagName:  "nested-2-field-1",
+						FlagName:  "nested2-field1",
 					},
 				},
 				{
 					StructField: reflect.TypeOf(nested2{}).Field(0),
 					Tag: Tag{
 						FieldName: "Nested2.Nested1.Field2.Field1",
-						FlagName:  "nested-2-field-2-field-1",
+						FlagName:  "nested2-field2-field1",
 					},
 				},
 			},