Skip to content

Commit 2a4bcbb

Browse files
committed
chore(linter): fix linter issues
Signed-off-by: Thore Sommer <mail@thson.de>
1 parent b7b1638 commit 2a4bcbb

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎nonce.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (o Nonce) Get(index int) []byte {
152152
return nil
153153
}
154154

155-
return o.values[index].get()
155+
return o.values[index].get() // nolint:gosec // G602: false positive bounds are checked above
156156
}
157157

158158
// AddHex provides the same functionality as Add except it takes the nonce value
@@ -175,7 +175,7 @@ func (o Nonce) MarshalCBOR() ([]byte, error) {
175175
}
176176

177177
if len(o.values) == 1 {
178-
return em.Marshal(o.values[0])
178+
return em.Marshal(o.values[0]) // nolint:gosec // G02: guaranteed to have one element
179179
}
180180

181181
return em.Marshal(o.values)
@@ -223,7 +223,7 @@ func (o Nonce) MarshalJSON() ([]byte, error) {
223223
}
224224

225225
if len(o.values) == 1 {
226-
return json.Marshal(o.values[0])
226+
return json.Marshal(o.values[0]) // nolint:gosec // G02: guaranteed to have one element
227227
}
228228

229229
return json.Marshal(o.values)

‎nonce_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func TestNonce_MarshalCBOR_multiple_ok(t *testing.T) {
104104
// deadbeefdeadbeef # "\xDE\xAD\xBE\xEF\xDE\xAD\xBE\xEF"
105105
// 48 # bytes(8)
106106
// abadcafeabadcafe # "\xAB\xAD\xCA\xFE\xAB\xAD\xCA\xFE"
107-
expected := []byte{0x82}
107+
expected := []byte{0x82} //nolint:prealloc // testing only
108108
expected = append(expected, byte(0x48))
109109
expected = append(expected, tv[0]...)
110110
expected = append(expected, byte(0x48))
@@ -151,7 +151,7 @@ func TestNonce_UnmarshalCBOR_multiple_ok(t *testing.T) {
151151
// deadbeefdeadbeef # "\xDE\xAD\xBE\xEF\xDE\xAD\xBE\xEF"
152152
// 48 # bytes(8)
153153
// abadcafeabadcafe # "\xAB\xAD\xCA\xFE\xAB\xAD\xCA\xFE"
154-
data := []byte{0x82}
154+
data := []byte{0x82} //nolint:prealloc // testing only
155155
data = append(data, byte(0x48))
156156
data = append(data, expected[0]...)
157157
data = append(data, byte(0x48))

0 commit comments

Comments
 (0)