Skip to content

Add lint-timezone check to enforce time.Local = time.UTC#77

Closed
a-monteiro wants to merge 1 commit intomainfrom
andre/lint-timezone
Closed

Add lint-timezone check to enforce time.Local = time.UTC#77
a-monteiro wants to merge 1 commit intomainfrom
andre/lint-timezone

Conversation

@a-monteiro
Copy link
Member

Summary

  • Adds a lint-timezone Makefile target that auto-discovers all cmd/*/main.go files and verifies they contain time.Local = time.UTC, failing with a clear error if any are missing
  • Runs as part of make lint, so it's caught both locally and in CI
  • Existing entrypoint already has the guard — this just prevents regressions

Context

Cross-repo follow-up to duneanalytics/core#5718 and duneanalytics/core#5729. The convention across Dune Go services is to set time.Local = time.UTC in init() at each binary entrypoint so time.Now() always returns UTC. This lint ensures new entrypoints don't forget it.

@cursor
Copy link

cursor bot commented Mar 9, 2026

PR Summary

Low Risk
Makefile-only change that adds a simple grep-based guard; risk is limited to potential false positives/negatives in the file-matching pattern.

Overview
Adds a new make lint-timezone target that scans all */cmd/*/main.go entrypoints and fails with a clear error if time.Local = time.UTC is missing.

Hooks this check into the existing lint target (and .PHONY) so timezone enforcement runs automatically during local development and CI.

Written by Cursor Bugbot for commit 4fc5ba5. Configure here.

@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

Warning

Rate limit exceeded

@a-monteiro has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 36 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 73edf41a-cc74-414a-9ac9-724e1f37d2c4

📥 Commits

Reviewing files that changed from the base of the PR and between ab1caf9 and 4fc5ba5.

📒 Files selected for processing (1)
  • Makefile

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Find pattern never matches existing entrypoint file
    • Changed the find path pattern from '/cmd//main.go' to '/cmd/' so it correctly matches the actual entrypoint at ./cmd/main.go.

Create PR

Or push these changes by commenting:

@cursor push 07f0f2b2fd
Preview (07f0f2b2fd)
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@
 # time.Now() always returns UTC.
 lint-timezone:
 	@fail=0; \
-	for f in $$(find . -name main.go -path '*/cmd/*/main.go'); do \
+	for f in $$(find . -name main.go -path '*/cmd/*'); do \
 		if ! grep -q 'time\.Local = time\.UTC' "$$f"; then \
 			echo "ERROR: $$f missing 'time.Local = time.UTC' in init()"; \
 			fail=1; \

Comment @cursor review or bugbot run to trigger another review on this PR

# time.Now() always returns UTC.
lint-timezone:
@fail=0; \
for f in $$(find . -name main.go -path '*/cmd/*/main.go'); do \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Find pattern never matches existing entrypoint file

High Severity

The find pattern -path '*/cmd/*/main.go' expects a subdirectory between cmd/ and main.go (e.g., cmd/foo/main.go), but the only entrypoint in this repo is cmd/main.go. The pattern will never match ./cmd/main.go, so the lint check silently passes with zero files checked, completely defeating its purpose. The build target on line 22 correctly references cmd/main.go directly.

Fix in Cursor Fix in Web

@a-monteiro a-monteiro closed this Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant