Skip to content

Commit 32e4cce

Browse files
silverwindclaude
andcommitted
Filter out Go pseudo-versions from update suggestions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9213315 commit 32e4cce

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

index.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ beforeAll(async () => {
181181
{path: "/github.com/google/go-github/v70/@latest", response: JSON.stringify({Version: "v70.0.0", Time: "2024-11-29T00:00:00Z"})},
182182
{path: "/github.com/example/testpkg/@latest", response: JSON.stringify({Version: "v1.0.0", Time: "2024-01-01T00:00:00Z"})},
183183
{path: "/github.com/example/testpkg/v2/@latest", response: JSON.stringify({Version: "v2.0.0", Time: "2025-01-01T00:00:00Z"})},
184+
{path: "/github.com/google/uuid/v2/@latest", response: JSON.stringify({Version: "v2.0.0-20260217135312-8c5a7de9ffa1", Time: "2026-02-17T13:53:12Z"})},
184185
];
185186
for (let v = 71; v <= 82; v++) {
186187
goProxyRoutes.push({

index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,11 @@ function buildGoModulePath(name: string, major: number): string {
533533
return `${name.replace(/\/v\d+$/, "")}/v${major}`;
534534
}
535535

536+
// TODO: maybe include pseudo-versions with --prerelease
537+
function isGoPseudoVersion(version: string): boolean {
538+
return /\d{14}-[0-9a-f]{12}$/.test(version);
539+
}
540+
536541
function parseGoMod(content: string): Record<string, string> {
537542
const deps: Record<string, string> = {};
538543
const lines = content.split(/\r?\n/);
@@ -1114,7 +1119,7 @@ function findNewVersion(data: any, {mode, range, useGreatest, useRel, usePre, se
11141119

11151120
// Check cross-major upgrade
11161121
const crossVersion = coerceToVersion(data.new);
1117-
if (crossVersion) {
1122+
if (crossVersion && !isGoPseudoVersion(data.new)) {
11181123
const d = diff(oldVersion, crossVersion);
11191124
if (d && semvers.has(d)) {
11201125
return data.new;
@@ -1123,7 +1128,7 @@ function findNewVersion(data: any, {mode, range, useGreatest, useRel, usePre, se
11231128

11241129
// Fall back to same-major upgrade
11251130
const sameVersion = coerceToVersion(data.sameMajorNew);
1126-
if (sameVersion) {
1131+
if (sameVersion && !isGoPseudoVersion(data.sameMajorNew)) {
11271132
const d = diff(oldVersion, sameVersion);
11281133
if (d && semvers.has(d)) {
11291134
data.Time = data.sameMajorTime;

0 commit comments

Comments
 (0)