From a84e8c70c0381c95dd0f466a8cd3174625540b72 Mon Sep 17 00:00:00 2001 From: xueqingz Date: Wed, 5 Jun 2024 09:19:23 +0000 Subject: [PATCH] CP-49768: Update GO SDK README file Signed-off-by: xueqingz --- ocaml/sdk-gen/README.md | 4 ++-- ocaml/sdk-gen/go/README.md | 39 ++++++++++++++++---------------------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/ocaml/sdk-gen/README.md b/ocaml/sdk-gen/README.md index fb4d71650bf..fa45a1c3803 100644 --- a/ocaml/sdk-gen/README.md +++ b/ocaml/sdk-gen/README.md @@ -1,10 +1,10 @@ # XenAPI Software Development Kit (SDK) -The SDK consists of five components, one for each of C, C#, Java, PowerShell, +The SDK consists of six components, one for each of C, C#, Go, Java, PowerShell, and Python, exposing the individual XenAPI calls as first-class functions in the target language. -The source code for the C, C#, Java, and PowerShell SDK is autogenerated from the +The source code for the C, C#, Go, Java, and PowerShell SDK is autogenerated from the XenAPI's datamodel. The generation code is written in OCaml and is contained in this directory. diff --git a/ocaml/sdk-gen/go/README.md b/ocaml/sdk-gen/go/README.md index c8ba2a4d62b..aa173a6b5d1 100644 --- a/ocaml/sdk-gen/go/README.md +++ b/ocaml/sdk-gen/go/README.md @@ -11,7 +11,7 @@ equally well to Go. In particular, the SDK Guide and the Management API Guide are ideal for developers wishing to use XenServer SDK for Go. XenServer SDK for Go is free software. You can redistribute and modify it under the -terms of the BSD 2-Clause license. See LICENSE.txt for details. +terms of the BSD 2-Clause license. See LICENSE for details. ## Reference @@ -40,35 +40,28 @@ This library requires Go 1.22 or greater. This archive contains the following folders that are relevant to Go developers: -- `XenServerGo\src`: contains the Go source files can be used as the local module in a Go project. +- `XenServerGo\src`: contains all Go source files which can be used as a local module for other Go projects. Every API object is associated with one Go file. ## Getting Started Extract the contents of this archive. -A. To set up the local go module: +A. Navigate to the extracted `XenServer-SDK\XenServerGo\src` directory and copy the whole folder `src` into your Go project directory. - 1. Create a new folder in your Go project, eg. `XenServerGo` - 2. Copy all files in `XenServerGo\src` to the new folder +B. To use XenServer Go SDK as a local Go module, update one line into the `go.mod` file under your Go project: -B. To use the XenServer module for Go in your Go project: +``` +replace xenapi => ./src +``` +You can then import this XenServer SDK Go module with the following command: - 1. Add the following lines to your go.mod file: +``` +import "xenapi" +``` - ``` - replace /XenServerGo => ./XenServerGo - ``` +C. Before building your project, run the following Go commands. - 2. Run the command: - - ``` - go mod tidy - ``` - - 3. Use the XenServer module for Go in file as follows: - - ``` - import ( - xenapi "/XenServerGo" - ) - ``` +``` +go get -u all +go mod tidy + ```