Skip to content

Commit 91433b9

Browse files
authored
Merge pull request #172 from maxmind/wstorey/fix-lints
Fix lints
2 parents abd7a7f + 23a7511 commit 91433b9

File tree

4 files changed

+4
-14
lines changed

4 files changed

+4
-14
lines changed

data_section.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ func (dw *dataWriter) maybeWrite(value *dataMapValue) (int, error) {
4949
}
5050

5151
written = writtenType{
52-
//nolint:gosec // checked above
5352
pointer: mmdbtype.Pointer(offset),
5453
size: size,
5554
}
@@ -97,7 +96,6 @@ func (dw *dataWriter) WriteOrWritePointer(t mmdbtype.DataType) (int64, error) {
9796
}
9897

9998
dw.offsets[key] = writtenType{
100-
//nolint:gosec // checked above
10199
pointer: mmdbtype.Pointer(offset),
102100
size: size,
103101
}

mmdbtype/types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ func (t Int32) Equal(other DataType) bool {
258258
}
259259

260260
func (t Int32) size() int {
261-
//nolint:gosec // this is correct.
262261
return 4 - bits.LeadingZeros32(uint32(t))/8
263262
}
264263

mmdbtype/types_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ func TestUint128(t *testing.T) {
212212
for i := 1; i <= bits/8; i++ {
213213
expected := &big.Int{}
214214

215-
//nolint:gosec // i is positive.
216215
expected.Lsh(big.NewInt(1), 8*uint(i))
217216
expected = expected.Sub(expected, big.NewInt(1))
218217
input := hex.EncodeToString([]byte{byte(i)}) + ctrlByte + strings.Repeat("ff", i)

tree.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ func Load(path string, opts Options) (*Tree, error) {
196196
}
197197

198198
if opts.IPVersion == 0 {
199-
//nolint:gosec // no risk. Will be 4 or 6.
200199
opts.IPVersion = int(metadata.IPVersion)
201200
}
202201

@@ -205,7 +204,6 @@ func Load(path string, opts Options) (*Tree, error) {
205204
}
206205

207206
if opts.RecordSize == 0 {
208-
//nolint:gosec // no risk. Will be 24, 28, or 32.
209207
opts.RecordSize = int(metadata.RecordSize)
210208
}
211209

@@ -653,17 +651,13 @@ func (t *Tree) writeMetadata(dw *dataWriter) (int64, error) {
653651

654652
// Although it might make sense to change the type on this, there is no use
655653
// case where someone would reasonably pass a negative build epoch.
656-
//nolint:gosec // See above.
657654
"build_epoch": mmdbtype.Uint64(t.buildEpoch),
658655
"database_type": mmdbtype.String(t.databaseType),
659656
"description": description,
660-
//nolint:gosec // no risk. Will be 4 or 6.
661-
"ip_version": mmdbtype.Uint16(t.ipVersion),
662-
"languages": languages,
663-
//nolint:gosec // checked above
664-
"node_count": mmdbtype.Uint32(t.nodeCount),
665-
//nolint:gosec // no risk. Will be 24, 28, or 32.
666-
"record_size": mmdbtype.Uint16(t.recordSize),
657+
"ip_version": mmdbtype.Uint16(t.ipVersion),
658+
"languages": languages,
659+
"node_count": mmdbtype.Uint32(t.nodeCount),
660+
"record_size": mmdbtype.Uint16(t.recordSize),
667661
}
668662
return metadata.WriteTo(dw)
669663
}

0 commit comments

Comments
 (0)