Skip to content

Commit d4eafa6

Browse files
jongioCopilot
andcommitted
fix: resolve golangci-lint issues (line length + gosec)
- Wrap long t.Fatalf lines to stay under 125 char limit (lll) - Replace JWT-like test token with plain string to avoid gosec G101 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent fe2250e commit d4eafa6

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

cli/azd/pkg/contracts/contracts_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func TestRFC3339Time_roundtrip(t *testing.T) {
127127
func TestAuthTokenResult_JSON(t *testing.T) {
128128
expiresOn := time.Date(2024, 6, 15, 12, 0, 0, 0, time.UTC)
129129
result := AuthTokenResult{
130-
Token: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9",
130+
Token: "test-token-value", //nolint:gosec // test data, not a real credential
131131
ExpiresOn: RFC3339Time(expiresOn),
132132
}
133133

@@ -138,7 +138,7 @@ func TestAuthTokenResult_JSON(t *testing.T) {
138138
err = json.Unmarshal(data, &parsed)
139139
require.NoError(t, err)
140140

141-
assert.Equal(t, "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9", parsed["token"])
141+
assert.Equal(t, "test-token-value", parsed["token"])
142142
assert.Equal(t, "2024-06-15T12:00:00Z", parsed["expiresOn"])
143143
}
144144

cli/azd/pkg/ux/ux_additional_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,19 @@ func TestPrinter_SetCursorPosition_same_position_noop(t *testing.T) {
197197
p.SetCursorPosition(pos)
198198
afterFirst := buf.Len()
199199
if afterFirst <= beforeFirst {
200-
t.Fatalf("expected first SetCursorPosition to write initialization escape codes, len before = %d, after = %d", beforeFirst, afterFirst)
200+
t.Fatalf(
201+
"expected first SetCursorPosition to write escape codes, before = %d, after = %d",
202+
beforeFirst, afterFirst)
201203
}
202204

203205
// Setting same position should not write additional escape codes
204206
p.SetCursorPosition(pos)
205207
afterSecond := buf.Len()
206208

207209
if afterSecond != afterFirst {
208-
t.Fatalf("expected second SetCursorPosition with same position to be a no-op, len after first = %d, after second = %d", afterFirst, afterSecond)
210+
t.Fatalf(
211+
"expected same-position SetCursorPosition to be a no-op, first = %d, second = %d",
212+
afterFirst, afterSecond)
209213
}
210214
}
211215

0 commit comments

Comments
 (0)