Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all setup lint build test image-build image-push
.PHONY: all setup lint lint-timezone build test image-build image-push

TEST_TIMEOUT := 10s
SHELL := /bin/bash
Expand All @@ -22,13 +22,25 @@ bin/gofumpt: bin
build: cmd/main.go
CGO_ENABLED=0 go build -ldflags="-X github.com/duneanalytics/blockchain-ingester/client/duneapi.commitHash=$(shell git rev-parse --short HEAD)" -o indexer cmd/main.go

lint: bin/golangci-lint bin/gofumpt
lint: bin/golangci-lint bin/gofumpt lint-timezone
go fmt ./...
go vet ./...
bin/golangci-lint -c .golangci.yml run ./...
bin/gofumpt -l -e -d ./
go mod tidy

# All binary entrypoints must set time.Local = time.UTC in init() to ensure
# 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

if ! grep -q 'time\.Local = time\.UTC' "$$f"; then \
echo "ERROR: $$f missing 'time.Local = time.UTC' in init()"; \
fail=1; \
fi; \
done; \
if [ "$$fail" -eq 1 ]; then exit 1; fi

test:
go mod tidy
CGO_ENABLED=1 go test -timeout=$(TEST_TIMEOUT) -race -bench=. -benchmem -cover ./...
Expand Down