Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

librclone:Added example on using librclone with golang.

alankrit2ad217eeddde
diff --git a/librclone/README.md b/librclone/README.md
index 45d522828..5682c2d25 100644
--- a/librclone/README.md
+++ b/librclone/README.md
@@ -163,6 +163,29 @@ const char* input = "{"
With C++11 you can use raw string literals to avoid the C++ escaping of string
constants, leaving escaping only necessary for the contained JSON.
+## Example in golang
+
+Here is a go example to help you move files :
+
+```go
+func main() {
+ librclone.Initialize()
+ syncRequest: = syncRequest {
+ SrcFs: "<absolute_path>",
+ DstFs: ":s3,env_auth=false,access_key_id=<access>,secret_access_key=<secret>,endpoint='<endpoint>':<bucket>",
+ }
+
+ syncRequestJSON, err: = json.Marshal(syncRequest)
+ if err != nil {
+ fmt.Println(err)
+ }
+
+ out, status: = librclone.RPC("sync/copy", string(syncRequestJSON))
+ fmt.Println("Got status : %d and output %q", status, out)
+}
+
+```
+
## gomobile
The `gomobile` subdirectory contains the equivalent of the C binding but