librclone:Added example on using librclone with golang.

This commit is contained in:
alankrit 2023-03-11 20:47:54 +00:00 committed by Nick Craig-Wood
parent a3eb7f1142
commit 2ad217eedd

View File

@ -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