Skip to content
Snippets Groups Projects
Commit 58a1bbae authored by Erick Hitter's avatar Erick Hitter
Browse files

Linting

parent da31dc35
No related branches found
No related tags found
1 merge request!1Initial release
Pipeline #173 passed with stages
in 6 minutes and 44 seconds
...@@ -19,12 +19,12 @@ import ( ...@@ -19,12 +19,12 @@ import (
type config struct { type config struct {
DebugDest string `json:"debug-dest"` DebugDest string `json:"debug-dest"`
Debug bool `json:"debug"` Debug bool `json:"debug"`
ApiKey string `json:"api-key"` APIKey string `json:"api-key"`
Threshold int `json:"threshold"` Threshold int `json:"threshold"`
Schedule string `json:"schedule"` Schedule string `json:"schedule"`
} }
type TokenSource struct { type tokenSource struct {
AccessToken string AccessToken string
} }
...@@ -65,7 +65,7 @@ func init() { ...@@ -65,7 +65,7 @@ func init() {
debugDest = cfg.DebugDest debugDest = cfg.DebugDest
debug = cfg.Debug debug = cfg.Debug
apiKey = cfg.ApiKey apiKey = cfg.APIKey
threshold = cfg.Threshold threshold = cfg.Threshold
schedule = cfg.Schedule schedule = cfg.Schedule
...@@ -92,7 +92,7 @@ func main() { ...@@ -92,7 +92,7 @@ func main() {
} }
func authenticate() { func authenticate() {
tokenSource := &TokenSource{ tokenSource := &tokenSource{
AccessToken: apiKey, AccessToken: apiKey,
} }
...@@ -100,22 +100,24 @@ func authenticate() { ...@@ -100,22 +100,24 @@ func authenticate() {
client = godo.NewClient(oauthClient) client = godo.NewClient(oauthClient)
} }
func (t *TokenSource) Token() (*oauth2.Token, error) { // oAuth token
func (t *tokenSource) Token() (*oauth2.Token, error) {
token := &oauth2.Token{ token := &oauth2.Token{
AccessToken: t.AccessToken, AccessToken: t.AccessToken,
} }
return token, nil return token, nil
} }
func startCron() { func startCron() {
c := cron.New() c := cron.New()
c.AddFunc(schedule, checkApi) c.AddFunc(schedule, checkAPI)
c.Start() c.Start()
} }
func checkApi() { func checkAPI() {
context := context.TODO() ctx := context.TODO()
droplets, err := listDroplets(context, client) droplets, err := listDroplets(ctx, client)
if err != nil { if err != nil {
logger.Fatal("Failed to retrieve droplet list") logger.Fatal("Failed to retrieve droplet list")
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment