Merge pull request #12516 from mikelolasagasti/pr-shared-error-atoi
Fix fmt.Errorf format argument in ParseFullReference
This commit is contained in:
commit
3220ab5ab2
2 changed files with 6 additions and 1 deletions
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue