filepath.Join()
function calls GO-W40011922 log.Warn("failed to replicate file", zap.String("name", name), zap.String("member", member.GetName()))
1923 return errs.ErrClientURLEmpty.FastGenByArgs()
1924 }
1925 url := clientUrls[0] + filepath.Join("/pd/api/v1/admin/persist-file", name)1926 req, _ := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewBuffer(data))
1927 req.Header.Set(apiutil.PDAllowFollowerHandleHeader, "true")
1928 res, err := s.httpClient.Do(req)
Package path/filepath
implements utility routines for manipulating filename
paths in a way compatible with the target operating system-defined file paths.
As the implementation automatically decides the path separator based on the
target operating system, it is recommended to not include backward or forward
slash in any of the arguments to filepath.Join
as it might result in improper
filepaths.
The filepath
package uses either forward slashes or backslashes, depending on
the operating system. To process paths such as URLs that always use forward
slashes regardless of the operating system, path
package is used.
// Target OS: Windows (forward slash won't be cleaned anymore as target OS expects backward slash)
filepath.Join("dir/", filename)
filepath.Join("dir", filename)