[tools] internal/modindex: fix clock race causing test flakes

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Apr 9, 2026, 9:09:30 PM (6 hours ago) Apr 9
to Alan Donovan, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Peter Weinberger, Go LUCI, Hongxiang Jiang, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
internal/modindex: fix clock race causing test flakes

time.Now uses a high-res VDSO timer, but on Linux the clock used to
set file mtimes is lower res and may lag. This leads to a
race that causes TestIncremental{,Nope} to flake.

This CL subtracts 1s from the high-res time so that it is not
behind the file mtime.

Fixes golang/go#74658
Change-Id: I7e2cca4adbd66c918325ea88d7d9cb3494456441
Auto-Submit: Alan Donovan <adon...@google.com>
Reviewed-by: Peter Weinberger <p...@google.com>
Files:
  • M internal/modindex/dir_test.go
  • M internal/modindex/modindex.go
Change size: XS
Delta: 2 files changed, 5 insertions(+), 3 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Peter Weinberger
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I7e2cca4adbd66c918325ea88d7d9cb3494456441
Gerrit-Change-Number: 765120
Gerrit-PatchSet: 2
Gerrit-Owner: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Peter Weinberger <p...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages