mirror of
https://github.com/rclone/rclone.git
synced 2024-12-22 23:22:08 +01:00
staticcheck: use golang.org/x/text/cases instead of deprecated strings.Title
strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0. The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.
This commit is contained in:
parent
7822df565e
commit
5b579cea47
@ -17,6 +17,8 @@ import (
|
|||||||
"github.com/rclone/rclone/lib/atexit"
|
"github.com/rclone/rclone/lib/atexit"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/pflag"
|
"github.com/spf13/pflag"
|
||||||
|
"golang.org/x/text/cases"
|
||||||
|
"golang.org/x/text/language"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Root is the main rclone command
|
// Root is the main rclone command
|
||||||
@ -316,7 +318,8 @@ func showBackend(name string) {
|
|||||||
optionsType = "advanced"
|
optionsType = "advanced"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fmt.Printf("### %s options\n\n", strings.Title(optionsType))
|
optionsType = cases.Title(language.Und, cases.NoLower).String(optionsType)
|
||||||
|
fmt.Printf("### %s options\n\n", optionsType)
|
||||||
fmt.Printf("Here are the %s options specific to %s (%s).\n\n", optionsType, backend.Name, backend.Description)
|
fmt.Printf("Here are the %s options specific to %s (%s).\n\n", optionsType, backend.Name, backend.Description)
|
||||||
optionsType = "advanced"
|
optionsType = "advanced"
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
|
@ -47,6 +47,8 @@ import (
|
|||||||
"github.com/rclone/rclone/fstest/fstests"
|
"github.com/rclone/rclone/fstest/fstests"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
"golang.org/x/text/cases"
|
||||||
|
"golang.org/x/text/language"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Some times used in the tests
|
// Some times used in the tests
|
||||||
@ -270,7 +272,7 @@ func TestHashSums(t *testing.T) {
|
|||||||
if !hashes.Contains(test.ht) {
|
if !hashes.Contains(test.ht) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
name := strings.Title(test.ht.String())
|
name := cases.Title(language.Und, cases.NoLower).String(test.ht.String())
|
||||||
if test.download {
|
if test.download {
|
||||||
name += "Download"
|
name += "Download"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user