Fix lint errors

This commit is contained in:
世界
2026-05-14 22:53:22 +08:00
parent 4b55717612
commit 2c2e08e608
38 changed files with 284 additions and 333 deletions
@@ -374,10 +374,6 @@ func (b *profileBuilder) emitLocation() uint64 {
return id
}
func (b *profileBuilder) addMapping(lo uint64, hi uint64, offset uint64, file string, buildID string) {
b.addMappingEntry(lo, hi, offset, file, buildID, false)
}
func (b *profileBuilder) addMappingEntry(lo uint64, hi uint64, offset uint64, file string, buildID string, fake bool) {
b.mem = append(b.mem, memMap{
start: uintptr(lo),
@@ -14,7 +14,10 @@ func isExecutable(protection int32) bool {
}
func (b *profileBuilder) readMapping() {
if !machVMInfo(b.addMapping) {
added := machVMInfo(func(lo, hi, offset uint64, file, buildID string) {
b.addMappingEntry(lo, hi, offset, file, buildID, false)
})
if !added {
b.addMappingEntry(0, 0, 0, "", "", true)
}
}
@@ -6,7 +6,9 @@ import "os"
func (b *profileBuilder) readMapping() {
data, _ := os.ReadFile("/proc/self/maps")
stdParseProcSelfMaps(data, b.addMapping)
stdParseProcSelfMaps(data, func(lo, hi, offset uint64, file, buildID string) {
b.addMappingEntry(lo, hi, offset, file, buildID, false)
})
if len(b.mem) == 0 {
b.addMappingEntry(0, 0, 0, "", "", true)
}
@@ -320,7 +320,7 @@ func writeHeapProto(w io.Writer, profile []memProfileRecord, rate int64, default
var locs []uint64
for _, record := range profile {
hideRuntime := true
for tries := 0; tries < 2; tries++ {
for range 2 {
stk := record.Stack
if hideRuntime {
for i, addr := range stk {