Prevent gin.SetMode from causing race conditions#2330
Conversation
PR SummaryMedium Risk Overview Reviewed by Cursor Bugbot for commit 9805594. Bugbot is set up for automated code reviews on this repo. Configure here. |
jakubno
left a comment
There was a problem hiding this comment.
can we just set it to release mode when starting gin server in code? I don't think there's any benefit for us to use debug ever
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2a5023b. Configure here.
already set via env var in the nomad job
There is lots of very useful output that gin provides with mode=debug that can help with debugging local issues. It makes perfect sense to run it locally with debug, but disable it when deploying. It can also be useful to turn it on temporarily when deployed, to identify mismatches in paths, routes, requests sent vs requests received, things like that. Seems silly to prevent ourselves from using it when turning it off only when deploying is so simple. |

gin.SetModegin.SetModewrites a global variablegin.SetModein multiple tests that run in parallel can cause data race conditions.This PR removes them and uses the environment variable to gain the same effect. We set
GIN_MODE=testwhen running tests in github actions, andGIN_MODE=releasewhen deploying any jobs.