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:
parent
1e6bb88c6d
commit
d4cd79e28c
24 changed files with 272 additions and 58 deletions
2
pkg/cmd/cache/delete/delete.go
vendored
2
pkg/cmd/cache/delete/delete.go
vendored
|
|
@ -147,7 +147,7 @@ func deleteRun(opts *DeleteOptions) error {
|
|||
}
|
||||
}
|
||||
for _, cache := range caches.ActionsCaches {
|
||||
toDelete = append(toDelete, strconv.Itoa(cache.Id))
|
||||
toDelete = append(toDelete, strconv.FormatInt(cache.Id, 10))
|
||||
}
|
||||
} else {
|
||||
toDelete = append(toDelete, opts.Identifier)
|
||||
|
|
|
|||
2
pkg/cmd/cache/shared/shared.go
vendored
2
pkg/cmd/cache/shared/shared.go
vendored
|
|
@ -22,7 +22,7 @@ var CacheFields = []string{
|
|||
|
||||
type Cache struct {
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
Id int `json:"id"`
|
||||
Id int64 `json:"id"`
|
||||
Key string `json:"key"`
|
||||
LastAccessedAt time.Time `json:"last_accessed_at"`
|
||||
Ref string `json:"ref"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue