Skip to content

Commit

Permalink
internal/pkgbits: cleanup pre-Go 1.17 workaround
Browse files Browse the repository at this point in the history
Now that golang/go#44505 is resolved, we can simplify frames_go1*.go.

This was already done in GOROOT in https://go.dev/cl/420903.

Change-Id: Ia7f2a123794fad62532bae2da267b0c8034917bc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/609955
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
  • Loading branch information
timothy-king committed Aug 30, 2024
1 parent 264b4b5 commit e5ae0a9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 49 deletions.
21 changes: 0 additions & 21 deletions internal/pkgbits/frames_go1.go

This file was deleted.

28 changes: 0 additions & 28 deletions internal/pkgbits/frames_go17.go

This file was deleted.

19 changes: 19 additions & 0 deletions internal/pkgbits/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package pkgbits

import (
"fmt"
"runtime"
"strings"
)

Expand All @@ -23,6 +24,24 @@ func fmtFrames(pcs ...uintptr) []string {

type frameVisitor func(file string, line int, name string, offset uintptr)

// walkFrames calls visit for each call frame represented by pcs.
//
// pcs should be a slice of PCs, as returned by runtime.Callers.
func walkFrames(pcs []uintptr, visit frameVisitor) {
if len(pcs) == 0 {
return
}

frames := runtime.CallersFrames(pcs)
for {
frame, more := frames.Next()
visit(frame.File, frame.Line, frame.Function, frame.PC-frame.Entry)
if !more {
return
}
}
}

// SyncMarker is an enum type that represents markers that may be
// written to export data to ensure the reader and writer stay
// synchronized.
Expand Down

0 comments on commit e5ae0a9

Please sign in to comment.