mirror of
https://github.com/containerd/containerd.git
synced 2026-08-09 01:21:15 +00:00
fix: QF1004: strings.ReplaceAll instead (staticcheck)
Signed-off-by: yashsingh74 <yashsingh1774@gmail.com>
This commit is contained in:
@@ -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"),
|
||||
)
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user