Skip to content

Commit 6b02a21

Browse files
committed
Replace %q to %d for invalid code string formatting
1 parent 9d9a96f commit 6b02a21

File tree

1,235 files changed

+723229
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,235 files changed

+723229
-1
lines changed

.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch Package",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"program": "${fileDirname}"
13+
}
14+
]
15+
}

codes/codes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func (c *Code) UnmarshalJSON(b []byte) error {
235235

236236
if ci, err := strconv.ParseUint(string(b), 10, 32); err == nil {
237237
if ci >= _maxCode {
238-
return fmt.Errorf("invalid code: %q", ci)
238+
return fmt.Errorf("invalid code: %d", ci)
239239
}
240240

241241
*c = Code(ci)

codes/codes_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,12 @@ func (s) TestUnmarshalJSON_MarshalUnmarshal(t *testing.T) {
9191
}
9292
}
9393
}
94+
95+
func (s) TestUnmarshalJSON_InvalidIntegerCode(t *testing.T) {
96+
var got Code
97+
wantErr := "invalid code: 200"
98+
err := got.UnmarshalJSON([]byte("200"))
99+
if err.Error() != wantErr { // for integer invalid code, expect integer value in error message
100+
t.Errorf("got.UnmarshalJSON(200) != %s; got=%s", wantErr, err.Error())
101+
}
102+
}

vendor/cloud.google.com/go/compute/LICENSE

Lines changed: 202 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/cloud.google.com/go/compute/internal/version.go

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/cloud.google.com/go/compute/metadata/CHANGES.md

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)