From 58a1bbae25b8d8a6b97bd0402a13b2a568a2e4d6 Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Sun, 19 Aug 2018 13:11:35 -0700 Subject: [PATCH] Linting --- glrdomon.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/glrdomon.go b/glrdomon.go index 29bd014..e2e39c5 100644 --- a/glrdomon.go +++ b/glrdomon.go @@ -19,12 +19,12 @@ import ( type config struct { DebugDest string `json:"debug-dest"` Debug bool `json:"debug"` - ApiKey string `json:"api-key"` + APIKey string `json:"api-key"` Threshold int `json:"threshold"` Schedule string `json:"schedule"` } -type TokenSource struct { +type tokenSource struct { AccessToken string } @@ -65,7 +65,7 @@ func init() { debugDest = cfg.DebugDest debug = cfg.Debug - apiKey = cfg.ApiKey + apiKey = cfg.APIKey threshold = cfg.Threshold schedule = cfg.Schedule @@ -92,7 +92,7 @@ func main() { } func authenticate() { - tokenSource := &TokenSource{ + tokenSource := &tokenSource{ AccessToken: apiKey, } @@ -100,22 +100,24 @@ func authenticate() { client = godo.NewClient(oauthClient) } -func (t *TokenSource) Token() (*oauth2.Token, error) { +// oAuth token +func (t *tokenSource) Token() (*oauth2.Token, error) { token := &oauth2.Token{ AccessToken: t.AccessToken, } + return token, nil } func startCron() { c := cron.New() - c.AddFunc(schedule, checkApi) + c.AddFunc(schedule, checkAPI) c.Start() } -func checkApi() { - context := context.TODO() - droplets, err := listDroplets(context, client) +func checkAPI() { + ctx := context.TODO() + droplets, err := listDroplets(ctx, client) if err != nil { logger.Fatal("Failed to retrieve droplet list") } -- GitLab