Merge pull request #12516 from mikelolasagasti/pr-shared-error-atoi

Fix fmt.Errorf format argument in ParseFullReference
This commit is contained in:
Babak K. Shandiz 2026-01-21 23:38:49 +00:00 committed by GitHub
commit 3220ab5ab2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -349,7 +349,7 @@ func ParseFullReference(s string) (ghrepo.Interface, int, error) {
number, err := strconv.Atoi(m[3])
if err != nil {
return nil, 0, fmt.Errorf("invalid reference: %q", number)
return nil, 0, fmt.Errorf("invalid reference: %q; %w", s, err)
}
owner := m[1]

View file

@ -160,6 +160,11 @@ func TestParseFullReference(t *testing.T) {
arg: "OWNER/#123",
wantErr: `invalid reference: "OWNER/#123"`,
},
{
name: "invalid full form, too large number",
arg: "OWNER/REPO#9999999999999999999",
wantErr: `invalid reference: "OWNER/REPO#9999999999999999999"; strconv.Atoi: parsing "9999999999999999999": value out of range`,
},
}
for _, tt := range tests {