Skip to content

Commit ee16e4e

Browse files
committed
Use new GoVersion detection
1 parent 09e6589 commit ee16e4e

3 files changed

Lines changed: 8 additions & 124 deletions

File tree

interpreter/golang/golang.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package golang // import "go.opentelemetry.io/ebpf-profiler/interpreter/golang"
22

33
import (
4-
"errors"
54
"fmt"
65
"regexp"
76
"unsafe"
@@ -50,14 +49,14 @@ func Loader(_ interpreter.EbpfHandler, info *interpreter.LoaderInfo) (interprete
5049
if err != nil {
5150
return nil, err
5251
}
53-
goVersion, err := ReadGoVersion(file)
54-
if errors.Is(err, ErrNoGoVersion) {
55-
log.Debugf("file %s is not a Go binary", info.FileName())
56-
return nil, nil
57-
}
52+
goVersion, err := file.GoVersion()
5853
if err != nil {
5954
return nil, err
6055
}
56+
if goVersion == "" {
57+
log.Debugf("file %s is not a Go binary", info.FileName())
58+
return nil, nil
59+
}
6160
log.Debugf("file %s detected as go version %s", info.FileName(), goVersion)
6261
majorMinor := goMajorMinorRegex.FindString(goVersion)
6362
if majorMinor == "" {

interpreter/golang/readelf.go

Lines changed: 0 additions & 118 deletions
This file was deleted.

testutils/helpers.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ func readTracePipe(ctx context.Context) {
112112
if errors.Is(err, io.EOF) {
113113
continue
114114
}
115+
if errors.Is(err, os.ErrClosed) {
116+
return
117+
}
115118
log.Error(err)
116119
return
117120
}

0 commit comments

Comments
 (0)