MCPcopy
hub / github.com/rclone/rclone / RandomRemoteName

Function RandomRemoteName

fstest/fstest.go:425–446  ·  view source on GitHub ↗

RandomRemoteName makes a random bucket or subdirectory name Returns a random remote name plus the leaf name

(remoteName string)

Source from the content-addressed store, hash-verified

423//
424// Returns a random remote name plus the leaf name
425func RandomRemoteName(remoteName string) (string, string, error) {
426 var err error
427 var leafName string
428
429 // Make a directory if remote name is null
430 if remoteName == "" {
431 remoteName, err = LocalRemote()
432 if err != nil {
433 return "", "", err
434 }
435 } else {
436 if !strings.HasSuffix(remoteName, ":") {
437 remoteName += "/"
438 }
439 leafName = "rclone-test-" + random.String(12)
440 if !MatchTestRemote.MatchString(leafName) {
441 fs.Fatalf(nil, "%q didn't match the test remote name regexp", leafName)
442 }
443 remoteName += leafName
444 }
445 return remoteName, leafName, nil
446}
447
448// RandomRemote makes a random bucket or subdirectory on the remote
449// from the -remote parameter

Callers 3

TestListWithoutMetadataFunction · 0.92
RunFunction · 0.92
RandomRemoteFunction · 0.85

Calls 3

StringFunction · 0.92
FatalfFunction · 0.92
LocalRemoteFunction · 0.85

Tested by 1

TestListWithoutMetadataFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…