Skip to content

Commit e7939e8

Browse files
Format code example in README (#510)
1 parent 3bcb4a6 commit e7939e8

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

README.md

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,35 @@ package main
3333
import (
3434
"context"
3535
"fmt"
36-
37-
"github.com/linode/linodego"
38-
"golang.org/x/oauth2"
39-
4036
"log"
4137
"net/http"
4238
"os"
39+
40+
"github.com/linode/linodego"
41+
"golang.org/x/oauth2"
4342
)
4443

4544
func main() {
46-
apiKey, ok := os.LookupEnv("LINODE_TOKEN")
47-
if !ok {
48-
log.Fatal("Could not find LINODE_TOKEN, please assert it is set.")
49-
}
50-
tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: apiKey})
51-
52-
oauth2Client := &http.Client{
53-
Transport: &oauth2.Transport{
54-
Source: tokenSource,
55-
},
56-
}
57-
58-
linodeClient := linodego.NewClient(oauth2Client)
59-
linodeClient.SetDebug(true)
60-
61-
res, err := linodeClient.GetInstance(context.Background(), 4090913)
62-
if err != nil {
63-
log.Fatal(err)
64-
}
65-
fmt.Printf("%v", res)
45+
apiKey, ok := os.LookupEnv("LINODE_TOKEN")
46+
if !ok {
47+
log.Fatal("Could not find LINODE_TOKEN, please assert it is set.")
48+
}
49+
tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: apiKey})
50+
51+
oauth2Client := &http.Client{
52+
Transport: &oauth2.Transport{
53+
Source: tokenSource,
54+
},
55+
}
56+
57+
linodeClient := linodego.NewClient(oauth2Client)
58+
linodeClient.SetDebug(true)
59+
60+
res, err := linodeClient.GetInstance(context.Background(), 4090913)
61+
if err != nil {
62+
log.Fatal(err)
63+
}
64+
fmt.Printf("%v", res)
6665
}
6766
```
6867

0 commit comments

Comments
 (0)