This is an automated email from the ASF dual-hosted git repository.

houqp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new b3eb67a  Make sample code self-contained & fix errors inside (#7)
b3eb67a is described below

commit b3eb67a3623e036738e769fb2c23ecdf31f32d19
Author: Xiaodong DENG <[email protected]>
AuthorDate: Wed Mar 24 19:30:11 2021 +0100

    Make sample code self-contained & fix errors inside (#7)
    
    - make the sample usage code self-contained
    - fix a few errors inside: 1. wrong variable name ("cli"); 2. if-else block 
handling err was wrong
---
 README.md | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index c89d776..4f61c2b 100644
--- a/README.md
+++ b/README.md
@@ -27,14 +27,18 @@ Usage
 -----
 
 ```go
+package main
+
 import (
+       "context"
+       "fmt"
        "github.com/apache/airflow-client-go/airflow"
 )
 
 func main() {
        cli := airflow.NewAPIClient(&airflow.Configuration{
                Scheme:   "http",
-               Host:     "localhost:28080",
+               Host:     "localhost:8080",
                BasePath: "/api/v1",
        })
 
@@ -44,11 +48,11 @@ func main() {
        }
        ctx := context.WithValue(context.Background(), 
airflow.ContextBasicAuth, cred)
 
-       variable, _, err := client.VariableApi.GetVariable(ctx, "foo")
+       variable, _, err := cli.VariableApi.GetVariable(ctx, "foo")
        if err != nil {
-               fmt.Println(variable)
-       } else {
                fmt.Println(err)
+       } else {
+               fmt.Println(variable)
        }
 }
 ```

Reply via email to