Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Remove unnecessary usage of nolint:gosec #12112

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
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
}
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 @@ -148,7 +148,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 @@ -157,7 +156,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
1 change: 0 additions & 1 deletion processor/memorylimiterprocessor/memorylimiter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func TestNoDataLoss(t *testing.T) {
runtime.ReadMemStats(&ms)

// Set the limit to current usage plus expected increase. This means initially we will not be limited.
// nolint:gosec
cfg.MemoryLimitMiB = uint32(ms.Alloc/(1024*1024) + expectedMemoryIncreaseMiB)
cfg.MemorySpikeLimitMiB = 1

Expand Down
1 change: 0 additions & 1 deletion service/internal/graph/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ func (n nodeID) ID() int64 {
func newNodeID(parts ...string) nodeID {
h := fnv.New64a()
h.Write([]byte(strings.Join(parts, "|")))
// nolint:gosec
return nodeID(h.Sum64())
}
5 changes: 0 additions & 5 deletions service/internal/proctelemetry/process_telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func RegisterProcessMetrics(cfg component.TelemetrySettings, opts ...RegisterOpt
ctx = context.WithValue(ctx, common.EnvKey, common.EnvMap{common.HostProcEnvKey: set.hostProc})
}
pm.context = ctx
// nolint:gosec
pm.proc, err = process.NewProcessWithContext(pm.context, int32(os.Getpid()))
if err != nil {
return err
Expand All @@ -94,23 +93,20 @@ func (pm *processMetrics) updateAllocMem() int64 {
pm.mu.Lock()
defer pm.mu.Unlock()
pm.readMemStatsIfNeeded()
// nolint:gosec
return int64(pm.ms.Alloc)
}

func (pm *processMetrics) updateTotalAllocMem() int64 {
pm.mu.Lock()
defer pm.mu.Unlock()
pm.readMemStatsIfNeeded()
// nolint:gosec
return int64(pm.ms.TotalAlloc)
}

func (pm *processMetrics) updateSysMem() int64 {
pm.mu.Lock()
defer pm.mu.Unlock()
pm.readMemStatsIfNeeded()
// nolint:gosec
return int64(pm.ms.Sys)
}

Expand All @@ -129,7 +125,6 @@ func (pm *processMetrics) updateRSSMemory() int64 {
if err != nil {
return 0
}
// nolint:gosec
return int64(mem.RSS)
}

Expand Down
Loading