Combined all examples into one big, runable source file with syntax coloring.
[arvados.git] / doc / sdk / go / index.html.textile.liquid
index e4653b2c13fe2cf751ec439c14ff92a571503a4b..58446a9edaf9ed05b5ac01deeb692affed4d5590 100644 (file)
@@ -12,59 +12,13 @@ h3. Installation
 
 You don't need to install anything. Just import the client like this. The go tools will fetch the relevant code and dependencies for you.
 
-<notextile>
-<pre><code class="userinput">import (
-       "git.curoverse.com/arvados.git/sdk/go/keepclient"
-       "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
-)
-</code></pre>
-</notextile>
+<notextile>{% code 'example_sdk_go_imports' as go %}</notextile>
 
 If you need pre-release client code, you can use the latest version from the repo by following "these instructions.":https://arvados.org/projects/arvados/wiki/Go#Using-Go-with-Arvados
 
-h3. Examples
+h3. Example
 
-Import the module. (We import the log module here too, so we can use it in the subsequent examples.)
-
-<notextile>
-<pre><code class="userinput">import (
-       "git.curoverse.com/arvados.git/sdk/go/keepclient"
-       "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
-       "log"
-)
-</code></pre>
-</notextile>
-
-Set up an API client user agent:
-
-<notextile>
-<pre><code class="userinput">  arv, err := arvadosclient.MakeArvadosClient()
-       if err != nil {
-               log.Fatalf("Error setting up arvados client %s", err.Error())
-       }
-</code></pre>
-</notextile>
-
-Get the User object for the current user:
-
-<notextile>
-<pre><code class="userinput">  type user struct {
-               Uuid       string   `json:"uuid"`
-               FullName   string   `json:"full_name"`
-       }
-
-       var u user
-       err := arv.Call("GET", "users", "", "current", nil, &u)
-
-       if err != nil {
-               return err
-       }
-
-       log.Printf("Logged in as %s (uuid %s)", user.Uuid, user.FullName)
-</code></pre>
-</notextile>
-
-Print all returned fields for collections:
+You can save this source as a .go file and run it:
 
 <notextile>{% code 'example_sdk_go' as go %}</notextile>