Use int64 for GitHub database IDs and add lint check

Change all struct fields representing GitHub database IDs from int to
int64 to match the API spec and prevent potential overflow on 32-bit
architectures.

Add a custom go/analysis linter (idtype-checker) that flags struct
fields with ID-like names or JSON tags using int instead of int64,
integrated into make lint.

Closes #9247

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
William Martin 2026-05-12 17:33:57 +02:00
parent 1e6bb88c6d
commit d4cd79e28c
24 changed files with 272 additions and 58 deletions

View file

@ -0,0 +1,16 @@
// Command idtype-checker runs the idtype analyzer to flag struct fields
// representing GitHub database IDs that use int instead of int64.
//
// Usage:
//
// go run ./cmd/idtype-checker ./...
package main
import (
"github.com/cli/cli/v2/pkg/linter/idtype"
"golang.org/x/tools/go/analysis/singlechecker"
)
func main() {
singlechecker.Main(idtype.Analyzer)
}