Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/builder/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
go.uber.org/goleak v1.3.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.27.1
golang.org/x/mod v0.28.0
golang.org/x/mod v0.30.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions cmd/builder/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion exporter/debugexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
go.opentelemetry.io/collector/pdata/xpdata v0.140.0
go.uber.org/goleak v1.3.0
go.uber.org/zap v1.27.1
golang.org/x/sys v0.37.0
golang.org/x/sys v0.38.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions exporter/debugexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ func (pq *persistentQueue[T]) internalSize() int64 {
}

func (pq *persistentQueue[T]) requestSize() int64 {
//nolint:gosec
return int64(pq.metadata.WriteIndex-pq.metadata.ReadIndex) + int64(len(pq.metadata.CurrentlyDispatchedItems))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,6 @@ func requireCurrentlyDispatchedItemsEqual(t *testing.T, pq *persistentQueue[intR
func itemIndexArrayToBytes(arr []uint64) []byte {
size := len(arr)
buf := make([]byte, 0, 4+size*8)
//nolint:gosec
buf = binary.LittleEndian.AppendUint32(buf, uint32(size))
for _, item := range arr {
buf = binary.LittleEndian.AppendUint64(buf, item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ func TestExtractHistogramDataPoints(t *testing.T) {

for i := 0; i < tt.numDataPoints; i++ {
dp := histogram.DataPoints().AppendEmpty()
dp.SetCount(uint64(i)) //nolint:gosec // disable G115
dp.SetCount(uint64(i))
}

sz := &mockMetricsSizer{dpSize: 1}
Expand Down Expand Up @@ -653,7 +653,7 @@ func TestExtractExponentialHistogramDataPoints(t *testing.T) {
expHistogram := srcMetric.SetEmptyExponentialHistogram()
for i := 0; i < tt.numDataPoints; i++ {
dp := expHistogram.DataPoints().AppendEmpty()
dp.SetCount(uint64(i)) //nolint:gosec // disable G115
dp.SetCount(uint64(i))
}

sz := &mockMetricsSizer{dpSize: 1}
Expand Down Expand Up @@ -702,7 +702,7 @@ func TestExtractSummaryDataPoints(t *testing.T) {
summary := srcMetric.SetEmptySummary()
for i := 0; i < tt.numDataPoints; i++ {
dp := summary.DataPoints().AppendEmpty()
dp.SetCount(uint64(i)) //nolint:gosec // disable G115
dp.SetCount(uint64(i))
}

sz := &mockMetricsSizer{dpSize: 1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type protoDeltaSizer struct{}
// - opentelemetry-collector/pdata/internal/data/protogen/profiles/v1development/profiles.pb.go
// which is generated with gogo/protobuf.
func (s *protoDeltaSizer) DeltaSize(newItemSize int) int {
return 1 + newItemSize + sov(uint64(newItemSize)) //nolint:gosec // disable G115
return 1 + newItemSize + sov(uint64(newItemSize))
}

func sov(x uint64) int {
Expand Down
1 change: 0 additions & 1 deletion internal/cmd/pdatagen/internal/proto/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ func genProtoTag(fieldNumber uint32, wt WireType) []string {
i := 0
keybuf := make([]byte, 0)
for i = 0; x > 127; i++ {
//nolint:gosec
keybuf = append(keybuf, 0x80|uint8(x&0x7F))
x >>= 7
}
Expand Down
1 change: 0 additions & 1 deletion internal/memorylimiter/iruntime/total_memory_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ func TotalMemory() (uint64, error) {
return totalMem, nil
}

//nolint:gosec
return uint64(memoryQuota), nil
}
6 changes: 3 additions & 3 deletions internal/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,14 @@ require (
golang.org/x/crypto v0.45.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/exp/typeparams v0.0.0-20251023183803-a4bb9ffd2546 // indirect
golang.org/x/mod v0.29.0 // indirect
golang.org/x/mod v0.30.0 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/sync v0.18.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8 // indirect
golang.org/x/telemetry v0.0.0-20251111182119-bc8e575c7b54 // indirect
golang.org/x/term v0.37.0 // indirect
golang.org/x/text v0.31.0 // indirect
golang.org/x/tools v0.38.0 // indirect
golang.org/x/tools v0.39.0 // indirect
golang.org/x/vuln v1.1.4 // indirect
google.golang.org/protobuf v1.36.8 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
Expand Down
12 changes: 6 additions & 6 deletions internal/tools/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions otelcol/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ func flags(reg *featuregate.Registry) *flag.FlagSet {
"Set arbitrary component config property. The component has to be defined in the config file and the flag"+
" has a higher precedence. Array config properties are overridden and maps are joined. Example --set=processors.batch.timeout=2s",
func(s string) error {
idx := strings.Index(s, "=")
if idx == -1 {
before, after, ok := strings.Cut(s, "=")
if !ok {
// No need for more context, see TestSetFlag/invalid_set.
return errors.New("missing equal sign")
}
cfgs.sets = append(cfgs.sets, "yaml:"+strings.TrimSpace(strings.ReplaceAll(s[:idx], ".", "::"))+": "+strings.TrimSpace(s[idx+1:]))
cfgs.sets = append(cfgs.sets, "yaml:"+strings.TrimSpace(strings.ReplaceAll(before, ".", "::"))+": "+strings.TrimSpace(after))
return nil
})

Expand Down
1 change: 0 additions & 1 deletion pdata/internal/proto/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ func EncodeVarint(buf []byte, offset int, v uint64) int {
offset -= Sov(v)
base := offset
for v >= 1<<7 {
//nolint:gosec
buf[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
Expand Down
1 change: 0 additions & 1 deletion pdata/internal/proto/size.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ func Sov(x uint64) (n int) {
}

func Soz(x uint64) (n int) {
//nolint:gosec
return Sov((x << 1) ^ uint64((int64(x) >> 63)))
}
3 changes: 0 additions & 3 deletions pdata/internal/proto/unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ func ConsumeLen(buf []byte, pos int) (int, int, error) {
if err != nil {
return 0, 0, err
}
//nolint:gosec
length := int(num)
if length < 0 {
return 0, 0, ErrInvalidLength
Expand All @@ -116,9 +115,7 @@ func ConsumeTag(buf []byte, pos int) (int32, WireType, int, error) {
if err != nil {
return 0, 0, 0, err
}
//nolint:gosec
fieldNum := int32(tag >> 3)
//nolint:gosec
wireType := int8(tag & 0x7)
if fieldNum <= 0 {
return 0, 0, 0, fmt.Errorf("proto: Link: illegal field=%d (tag=%d, pos=%d)", fieldNum, tag, pos)
Expand Down
2 changes: 0 additions & 2 deletions pdata/pcommon/timestamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ type Timestamp uint64

// NewTimestampFromTime constructs a new Timestamp from the provided time.Time.
func NewTimestampFromTime(t time.Time) Timestamp {
//nolint:gosec
return Timestamp(uint64(t.UnixNano()))
}

// AsTime converts this to a time.Time.
func (ts Timestamp) AsTime() time.Time {
//nolint:gosec
return time.Unix(0, int64(ts)).UTC()
}

Expand Down
1 change: 0 additions & 1 deletion pdata/pcommon/timestamp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

func TestUnixNanosConverters(t *testing.T) {
t1 := time.Date(2020, 3, 24, 1, 13, 23, 789, time.UTC)
//nolint:gosec
tun := Timestamp(t1.UnixNano())

assert.EqualValues(t, uint64(1585012403000000789), tun)
Expand Down
2 changes: 0 additions & 2 deletions pdata/pcommon/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ func (v Value) FromRaw(iv any) error {
case int64:
v.SetInt(tv)
case uint:
//nolint:gosec
v.SetInt(int64(tv))
case uint8:
v.SetInt(int64(tv))
Expand All @@ -175,7 +174,6 @@ func (v Value) FromRaw(iv any) error {
case uint32:
v.SetInt(int64(tv))
case uint64:
//nolint:gosec
v.SetInt(int64(tv))
case float32:
v.SetDouble(float64(tv))
Expand Down
4 changes: 2 additions & 2 deletions pdata/pprofile/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func SetAttribute(table KeyValueAndUnitSlice, attr KeyValueAndUnit) (int32, erro
if j > math.MaxInt32 {
return 0, errTooManyAttributeTableEntries
}
return int32(j), nil //nolint:gosec // G115 overflow checked
return int32(j), nil
}
}

Expand All @@ -50,5 +50,5 @@ func SetAttribute(table KeyValueAndUnitSlice, attr KeyValueAndUnit) (int32, erro
}

attr.CopyTo(table.AppendEmpty())
return int32(table.Len() - 1), nil //nolint:gosec // G115 overflow checked
return int32(table.Len() - 1), nil
}
8 changes: 4 additions & 4 deletions pdata/pprofile/attributes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func BenchmarkFromAttributeIndices(b *testing.B) {
dic.StringTable().Append(fmt.Sprintf("key_%d", i))

att := table.AppendEmpty()
att.SetKeyStrindex(int32(dic.StringTable().Len())) //nolint:gosec // overflow impossible in test
att.SetKeyStrindex(int32(dic.StringTable().Len()))
att.Value().SetStr(fmt.Sprintf("value_%d", i))
}

Expand Down Expand Up @@ -101,7 +101,7 @@ func TestSetAttribute(t *testing.T) {
idx, err = SetAttribute(table, attr2)
require.NoError(t, err)
assert.Equal(t, 2, table.Len())
assert.Equal(t, int32(table.Len()-1), idx) //nolint:gosec // G115
assert.Equal(t, int32(table.Len()-1), idx)

// Set an existing value
idx, err = SetAttribute(table, attr)
Expand All @@ -112,7 +112,7 @@ func TestSetAttribute(t *testing.T) {
idx, err = SetAttribute(table, attr2)
require.NoError(t, err)
assert.Equal(t, 2, table.Len())
assert.Equal(t, int32(table.Len()-1), idx) //nolint:gosec // G115
assert.Equal(t, int32(table.Len()-1), idx)
}

func BenchmarkSetAttribute(b *testing.B) {
Expand Down Expand Up @@ -160,7 +160,7 @@ func BenchmarkSetAttribute(b *testing.B) {
runBefore: func(_ *testing.B, table KeyValueAndUnitSlice) {
for i := range 100 {
l := table.AppendEmpty()
l.SetKeyStrindex(int32(i)) //nolint:gosec // overflow checked
l.SetKeyStrindex(int32(i))
}
},
},
Expand Down
4 changes: 2 additions & 2 deletions pdata/pprofile/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func SetFunction(table FunctionSlice, fn Function) (int32, error) {
if j > math.MaxInt32 {
return 0, errTooManyFunctionTableEntries
}
return int32(j), nil //nolint:gosec // G115 overflow checked
return int32(j), nil
}
}

Expand All @@ -27,5 +27,5 @@ func SetFunction(table FunctionSlice, fn Function) (int32, error) {
}

fn.CopyTo(table.AppendEmpty())
return int32(table.Len() - 1), nil //nolint:gosec // G115 overflow checked
return int32(table.Len() - 1), nil
}
6 changes: 3 additions & 3 deletions pdata/pprofile/functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestSetFunction(t *testing.T) {
idx, err = SetFunction(table, f2)
require.NoError(t, err)
assert.Equal(t, 2, table.Len())
assert.Equal(t, int32(table.Len()-1), idx) //nolint:gosec // G115
assert.Equal(t, int32(table.Len()-1), idx)

// Set an existing function
idx, err = SetFunction(table, f)
Expand All @@ -48,7 +48,7 @@ func TestSetFunction(t *testing.T) {
idx, err = SetFunction(table, f2)
require.NoError(t, err)
assert.Equal(t, 2, table.Len())
assert.Equal(t, int32(table.Len()-1), idx) //nolint:gosec // G115
assert.Equal(t, int32(table.Len()-1), idx)
}

func BenchmarkSetFunction(b *testing.B) {
Expand Down Expand Up @@ -96,7 +96,7 @@ func BenchmarkSetFunction(b *testing.B) {
runBefore: func(_ *testing.B, table FunctionSlice) {
for i := range 100 {
f := table.AppendEmpty()
f.SetNameStrindex(int32(i)) //nolint:gosec // overflow checked
f.SetNameStrindex(int32(i))
}
},
},
Expand Down
4 changes: 2 additions & 2 deletions pdata/pprofile/links.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func SetLink(table LinkSlice, li Link) (int32, error) {
if j > math.MaxInt32 {
return 0, errTooManyLinkTableEntries
}
return int32(j), nil //nolint:gosec // G115 overflow checked
return int32(j), nil
}
}

Expand All @@ -27,5 +27,5 @@ func SetLink(table LinkSlice, li Link) (int32, error) {
}

li.CopyTo(table.AppendEmpty())
return int32(table.Len() - 1), nil //nolint:gosec // G115 overflow checked
return int32(table.Len() - 1), nil
}
4 changes: 2 additions & 2 deletions pdata/pprofile/links_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestSetLink(t *testing.T) {
idx, err = SetLink(table, l2)
require.NoError(t, err)
assert.Equal(t, 2, table.Len())
assert.Equal(t, int32(table.Len()-1), idx) //nolint:gosec // G115
assert.Equal(t, int32(table.Len()-1), idx)

// Set an existing link
idx, err = SetLink(table, l)
Expand All @@ -49,7 +49,7 @@ func TestSetLink(t *testing.T) {
idx, err = SetLink(table, l2)
require.NoError(t, err)
assert.Equal(t, 2, table.Len())
assert.Equal(t, int32(table.Len()-1), idx) //nolint:gosec // G115
assert.Equal(t, int32(table.Len()-1), idx)
}

func BenchmarkSetLink(b *testing.B) {
Expand Down
4 changes: 2 additions & 2 deletions pdata/pprofile/locations.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func SetLocation(table LocationSlice, loc Location) (int32, error) {
if j > math.MaxInt32 {
return 0, errTooManyLocationTableEntries
}
return int32(j), nil //nolint:gosec // G115 overflow checked
return int32(j), nil
}
}

Expand All @@ -41,5 +41,5 @@ func SetLocation(table LocationSlice, loc Location) (int32, error) {
}

loc.CopyTo(table.AppendEmpty())
return int32(table.Len() - 1), nil //nolint:gosec // G115 overflow checked
return int32(table.Len() - 1), nil
}
Loading
Loading