Skip to content

Commit

Permalink
🔥 golang improvments (#992)
Browse files Browse the repository at this point in the history
* 🔥 golang improvments

* 🟢 fix build

* 🟢 fix build

* 🟢 fix build
  • Loading branch information
thibaultleouay authored Sep 2, 2024
1 parent a9c03d8 commit cc4dba9
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,12 @@
},
"[ignore]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],
"gopls": {
"ui.diagnostic.analyses": {
"fieldalignment": true
}
}
}
2 changes: 1 addition & 1 deletion apps/checker/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ func main() {

headersAsString, err := json.Marshal(r.Headers)
if err != nil {
return nil
return err
}

tbData := PingResponse{
Expand Down
10 changes: 7 additions & 3 deletions apps/checker/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,18 @@ func UpdateStatus(ctx context.Context, updateData UpdateData) {
url := "https://openstatus-api.fly.dev/updateStatus"
basic := "Basic " + os.Getenv("CRON_SECRET")
payloadBuf := new(bytes.Buffer)
json.NewEncoder(payloadBuf).Encode(updateData)
req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, payloadBuf)
if err := json.NewEncoder(payloadBuf).Encode(updateData); err != nil {
log.Ctx(ctx).Error().Err(err).Msg("error while updating status")
return
}
req, _ := http.NewRequestWithContext(ctx, http.MethodPost, url, payloadBuf)
req.Header.Set("Authorization", basic)
req.Header.Set("Content-Type", "application/json")

client := &http.Client{Timeout: time.Second * 10}
if _, err = client.Do(req); err != nil {
if _, err := client.Do(req); err != nil {
log.Ctx(ctx).Error().Err(err).Msg("error while updating status")
}
defer req.Body.Close()
// Should we add a retry mechanism here?
}
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
"DATABASE_URL",
"TINY_BIRD_API_KEY",
"NODE_ENV",
"VERCEL_URL"
"VERCEL_URL",
"TEAM_ID_VERCEL",
"PROJECT_ID_VERCEL",
"STRIPE_SECRET_KEY",
"UNKEY_TOKEN",
"UNKEY_API_ID",
"UPSTASH_REDIS_REST_URL",
"UPSTASH_REDIS_REST_TOKEN"
],
"outputs": [".next/**", "!.next/cache/**"]
},
Expand Down

0 comments on commit cc4dba9

Please sign in to comment.