Fix S1016 violations and drop suppression

This commit is contained in:
Tamir Duberstein
2026-02-10 11:56:13 -08:00
parent b1d95c3eab
commit 23b82c21cf
4 changed files with 7 additions and 21 deletions
-6
View File
@@ -239,12 +239,6 @@ analyzers:
# See above.
- "symbol \"runtime_pollWaitCanceled\".*"
- "symbol \"runtime_procPin\".*"
S1016: # Use a type conversion instead of manually copying struct fields
# disabled for now due to existing violations.
generated:
exclude: [".*"]
internal:
exclude: [".*"]
S1019: # Simplify make invocation for empty slices
# disabled for now due to existing violations.
internal:
+3 -3
View File
@@ -447,7 +447,7 @@ func (s *Set) InsertWithoutMergingUnchecked(gap GapIterator, r Range, val Value)
if splitMaxGap {
gap.node.updateMaxGapLeaf()
}
return Iterator{gap.node, gap.index}
return Iterator(gap)
}
// InsertRange inserts the given segment into the set. If the new segment can
@@ -586,7 +586,7 @@ func (s *Set) Remove(seg Iterator) GapIterator {
if trackGaps != 0 {
seg.node.updateMaxGapLeaf()
}
return seg.node.rebalanceAfterRemove(GapIterator{seg.node, seg.index})
return seg.node.rebalanceAfterRemove(GapIterator(seg))
}
// RemoveAll removes all segments from the set. All existing iterators are
@@ -1735,7 +1735,7 @@ func (seg Iterator) PrevGap() GapIterator {
// must be in a leaf node.
return seg.node.children[seg.index].lastSegment().NextGap()
}
return GapIterator{seg.node, seg.index}
return GapIterator(seg)
}
// NextGap returns the gap immediately after the iterated segment.
@@ -68,7 +68,7 @@ func (f *PreciseHostFileMapper) RequireAddrEqualsFileOffset() {
func (f *PreciseHostFileMapper) IncRefOn(mr memmap.MappableRange) {
f.refsMu.Lock()
defer f.refsMu.Unlock()
fr := memmap.FileRange{Start: mr.Start, End: mr.End}
fr := memmap.FileRange(mr)
seg, gap := f.refs.Find(fr.Start)
for seg.Ok() || gap.Ok() {
if seg.Ok() {
@@ -98,7 +98,7 @@ func (f *PreciseHostFileMapper) DecRefOn(mr memmap.MappableRange) {
if !rseg.Ok() {
panic(fmt.Sprintf("could not find segment for range %v", mr))
}
fr := memmap.FileRange{Start: mr.Start, End: mr.End}
fr := memmap.FileRange(mr)
for fr.Length() > 0 && rseg.Ok() {
rseg = f.refs.Isolate(rseg, fr)
refs := rseg.ValuePtr()
+2 -10
View File
@@ -3272,11 +3272,7 @@ func GetTCPSendBufferLimits(sh tcpip.StackHandler) tcpip.SendBufferSizeOption {
// This type assertion is safe because only the TCP stack calls this
// function.
ss := sh.(*stack.Stack).TCPSendBufferLimits()
return tcpip.SendBufferSizeOption{
Min: ss.Min,
Default: ss.Default,
Max: ss.Max,
}
return tcpip.SendBufferSizeOption(ss)
}
// allowOutOfWindowAck returns true if an out-of-window ACK can be sent now.
@@ -3304,11 +3300,7 @@ func GetTCPReceiveBufferLimits(s tcpip.StackHandler) tcpip.ReceiveBufferSizeOpti
panic(fmt.Sprintf("s.TransportProtocolOption(%d, %#v) = %s", header.TCPProtocolNumber, ss, err))
}
return tcpip.ReceiveBufferSizeOption{
Min: ss.Min,
Default: ss.Default,
Max: ss.Max,
}
return tcpip.ReceiveBufferSizeOption(ss)
}
// computeTCPSendBufferSize implements auto tuning of send buffer size and