From 2ad217eedddef31c2807d62b40efad518b600e26 Mon Sep 17 00:00:00 2001 From: alankrit Date: Sat, 11 Mar 2023 20:47:54 +0000 Subject: [PATCH] librclone:Added example on using librclone with golang. --- librclone/README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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: "", + DstFs: ":s3,env_auth=false,access_key_id=,secret_access_key=,endpoint='':", + } + + 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