fix: QF1004: strings.ReplaceAll instead (staticcheck)

Signed-off-by: yashsingh74 <yashsingh1774@gmail.com>
This commit is contained in:
yashsingh74
2025-04-19 10:54:16 +05:30
parent 56516173d0
commit 1ff5900044
3 changed files with 4 additions and 4 deletions

View File

@@ -25,11 +25,11 @@ import (
func hostPaths(root, host string) (hosts []string) {
ch := hostDirectory(host)
if ch != host {
hosts = append(hosts, filepath.Join(root, strings.Replace(ch, ":", "", -1)))
hosts = append(hosts, filepath.Join(root, strings.ReplaceAll(ch, ":", "")))
}
hosts = append(hosts,
filepath.Join(root, strings.Replace(host, ":", "", -1)),
filepath.Join(root, strings.ReplaceAll(host, ":", "")),
filepath.Join(root, "_default"),
)

View File

@@ -46,7 +46,7 @@ func (ec ErrorCode) ErrorCode() ErrorCode {
// Error returns the ID/Value
func (ec ErrorCode) Error() string {
// NOTE(stevvooe): Cannot use message here since it may have unpopulated args.
return strings.ToLower(strings.Replace(ec.String(), "_", " ", -1))
return strings.ToLower(strings.ReplaceAll(ec.String(), "_", " "))
}
// Descriptor returns the descriptor for the error code.

View File

@@ -104,7 +104,7 @@ func npipeDial(ctx context.Context, addr string) (net.Conn, error) {
func parseEndpoint(endpoint string) (string, string, error) {
// url.Parse doesn't recognize \, so replace with / first.
endpoint = strings.Replace(endpoint, "\\", "/", -1)
endpoint = strings.ReplaceAll(endpoint, "\\", "/")
u, err := url.Parse(endpoint)
if err != nil {
return "", "", err