Skip to content
Permalink
Browse files
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
  • Loading branch information
XD-DENG committed Mar 24, 2021
1 parent 424e074 commit b3eb67a3623e036738e769fb2c23ecdf31f32d19
Showing 1 changed file with 8 additions and 4 deletions.
@@ -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)
}
}
```

0 comments on commit b3eb67a

Please sign in to comment.