timelint

command module
v0.0.0-...-a3e3e00 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

timelint

timelint checks that every call to time.Now() in Go source is normalized to UTC via .UTC(). Timestamps that carry the host's local timezone can drift depending on the TZ environment variable, so all wall-clock time in the program must be UTC.

It follows an aliased import of time, and accepts only time.Now().UTC() chained directly: time.Now().Add(d).UTC() still fails. Test files are skipped, since fixtures may build time.Time values whose location is irrelevant to the assertion. So are generated files, with the Code generated ... DO NOT EDIT. header, and the .git and vendor directories.

timelint prints each call it finds as timelint: file:line:col: ... and exits 1 if there are any.

Install

go get -tool evantann.com/timelint@latest

Use

go tool timelint [dir ...]

It lints every Go file under each dir, the current directory by default. Reads stay within each dir, so a symlink can't lead the walk outside it. It takes no flags.

Makefile

lint-time:
	go tool timelint
.PHONY: lint-time

License

GNU Affero General Public License v3.0 or later. See LICENSE.

Documentation

Overview

Package main lints Go source to ensure every call to time.Now() is normalized to UTC via .UTC(). Timestamps that carry the host's local timezone can drift depending on the TZ environment variable, so all wall-clock time in the program must be UTC.

Test files are skipped: fixtures may build time.Time values whose location is irrelevant to the assertion. So are generated files, and the .git and vendor directories.

Usage:

timelint [dir ...]

It lints every Go file under each dir, the current directory by default.

Source Files

  • main.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL