File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed
Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -955,7 +955,7 @@ func (s *benchState) processBench(b *B) {
955955
956956 file , _ := fn .FileLine (pc )
957957 if strings .HasSuffix (file , "_codspeed.go" ) {
958- benchFile = file
958+ benchFile = removeFolderFromPath ( file , "codspeed" )
959959 }
960960 }
961961
Original file line number Diff line number Diff line change 55 "fmt"
66 "os"
77 "path/filepath"
8+ "strings"
89)
910
1011type GoRunnerMetadata struct {
@@ -87,3 +88,16 @@ func (b *B) AddBenchmarkMarkers(endTimestamp uint64) {
8788 // Reset to prevent accidental reuse
8889 b .startTimestamp = 0
8990}
91+
92+ func removeFolderFromPath (path string , folder string ) string {
93+ parts := strings .Split (path , string (os .PathSeparator ))
94+
95+ var newParts []string
96+ for _ , p := range parts {
97+ if p != folder {
98+ newParts = append (newParts , p )
99+ }
100+ }
101+
102+ return filepath .Join (newParts ... )
103+ }
Original file line number Diff line number Diff line change @@ -1077,6 +1077,7 @@ func (c *common) callSite(skip int) string {
10771077 // Replace _codspeed.go with _test.go for better user experience
10781078 if strings .HasSuffix (file , "_codspeed.go" ) {
10791079 file = strings .TrimSuffix (file , "_codspeed.go" ) + "_test.go"
1080+ file = removeFolderFromPath (file , "codspeed" )
10801081 }
10811082 } else {
10821083 file = "???"
You can’t perform that action at this time.
0 commit comments