Browse code

staticcheck: ignore "SA1019: strings.Title is deprecated"

This function is marked deprecated in Go 1.18; however, the suggested replacement
brings in a large amount of new code, and most strings we generate will be ASCII,
so this would only be in case it's used for some user-provided string. We also
don't have a language to use, so would be using the "default".

Adding a `//nolint` comment to suppress the linting failure instead.

daemon/logger/templates/templates.go:23:14: SA1019: strings.Title is deprecated: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (staticcheck)
"title": strings.Title,
^
pkg/plugins/pluginrpc-gen/template.go:67:9: SA1019: strings.Title is deprecated: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (staticcheck)
return strings.Title(s)
^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2022/02/01 00:07:40
Showing 2 changed files
... ...
@@ -20,7 +20,7 @@ var basicFunctions = template.FuncMap{
20 20
 	},
21 21
 	"split":    strings.Split,
22 22
 	"join":     strings.Join,
23
-	"title":    strings.Title,
23
+	"title":    strings.Title, //nolint:staticcheck // SA1019: strings.Title is deprecated: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.
24 24
 	"lower":    strings.ToLower,
25 25
 	"upper":    strings.ToUpper,
26 26
 	"pad":      padWithSpace,
... ...
@@ -64,7 +64,7 @@ func title(s string) string {
64 64
 	if strings.ToLower(s) == "id" {
65 65
 		return "ID"
66 66
 	}
67
-	return strings.Title(s)
67
+	return strings.Title(s) //nolint:staticcheck // SA1019: strings.Title is deprecated: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.
68 68
 }
69 69
 
70 70
 var generatedTempl = template.Must(template.New("rpc_cient").Funcs(templFuncs).Parse(`